DBD-InterBase: different date/time formats

  • pet

    pet - 2004-06-22


        I have a problem when fetching, especially when displaying date/time format received by DBD-InterBase driver in PERL. I have a few Perl scripts that generate different HTML documents - from a XML file and some InterBase data. Everything worked fine on Windows (with DBD-InterBase-0.40), I was getting [by query: SELECT TIME, VALUE, ID FROM TABLE1 WHERE (TIME > '1.5.2004 0:0:0' AND TIME < '20.5.2004 23:59:59')] and displaying date/time format in my HTML pages like:
        "15.5.2004 12:00:30" for fifteenth of May, year 2004 12:00PM (and 30 seconds).

        But when I installed DBD-InterBase driver (version -0.40, -0.42 and -0.43) on Unix (Linux SuSe ver2.4.21) the date/time format I was getting & displaying was:
        "Tue May 15, 12:00:30 2004" instead of "15.5.2004 12:00:30" (like on Windows).

        After that, I replaced the DBD-InterBase driver on both the Windows and Unix, and now I have DBD-InterBase-0.43 on both systems! But, still I'm getting date/time format like:
        - on Linux:    "Tue May 15, 12:00:30 2004", and
        - on Windows:    "05/15/04 12:00:30" (previously it was "15.5.2004 12:00:30")!

        I noticed (it was obvious) that date/time format is dependable of the DBD-InterBase driver, but still I cannot get my desired format, neither on Windows nor on Linux! (desired format should be like: "15.5.2004 12:00:30"). So, what should I do, or change to receive and display "my desired format" of date/time?

        Anyone, any ideas, hints, suggestions on this?

        I appreciate any help. Thanks.

    • pet

      pet - 2004-06-23

      Hi evebody,

      I found what I was missing; the (so called) my problem was in the date/time format, so I added a attribute:
      # desired format: "day.month.year Hour:Minutes:Seconds"
      $attr = { ib_timestampformat => '%d.%m.%Y %H:%M:%S' };
      before the prepare method:
      $sth = $dbh->prepare($query, $attr);
      . . .

      Everything else stayed as it was!

      Regards, Pet.

      • Yoz Grahame

        Yoz Grahame - 2004-06-23

        Sorry I didn't get around to posting this yesterday, but the other way of standardising your timestamps is:
            $dbh->{ib_time_all} = 'ISO';
        after you've created the database handle.

        -- Yoz


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks