Hi,

The default date format for the 64 bit version may be different than the 32 bit.

to compensate for this, I always set the default date format in my login subroutine. (outside of these options, I use the convert function in sybase)

I do something like this..

 my $dbh;

    eval{

        $dbh = DBI->connect(

            $mydatasource,

            $user,

            $password,

            {

                syb_failed_db_fatal => 1,

                syb_chained_txn     => 0,

                PrintError          => 0,

                AutoCommit          => 1,

                RaiseError          => 1,

                syb_date_fmt        => "MDY1_YYYY"

             }

        );

    };

    if ($@) {

        my $error_desc = "$@";

        $error_desc =~ s/\s+$//;

        print "...Gee, I couldn't connect.... \n";

        print "...Error: $error_desc\n...Script will now quit.\n";

        &graceful_exit();

    }

    else {

        print "......connection was successful...\n";

    }

    return($dbh)




You can look at the docs with..

perldoc DBD::Sybase

the section that is pertinent is the following..

syb_date_fmt() method.

       The syntax is

           $dbh->syb_date_fmt($fmt);

where $fmt is a string representing the format that you want to apply.

       Note that this requires DBI 1.37 or later.

       The formats are based on Sybase's standard conversion routines. The
       following subset of available formats has been implemented:

       LONG
           Nov 15 1998 11:30:11:496AM

       LONGMS
           New with ASE 15.5 - for bigtime/bigdatetime datatypes, includes
           microseconds:

           Apr  7 2010 10:40:33.532315PM

       SHORT
           Nov 15 1998 11:30AM

       DMY4_YYYY
           15 Nov 1998

       MDY1_YYYY
           11/15/1998

       DMY1_YYYY
           15/11/1998

       DMY2_YYYY
           15.11.1998

       YMD3_YYYY
           19981115

       HMS 11:30:11

       ISO 2004-08-21 14:36:48.080

       ISO_strict
           2004-08-21T14:36:48.080Z

Note that Sybase has no concept of a timezone, so the trailing "Z" is really not correct (assumes that the time is in UTC). However,
           there is no guarantee that the client and the server run in the
same timezone, so assuming the timezone of the client isn't really
           a valid option either.


On 2/7/13 9:53 AM, Gerardi, Mark wrote:
Has anyone had the chance to use the 64 bit versions of DBD Sybase using 
dates/times? I'm pulling out a date from Sybase 15, with the latest version of 
ctlib, and getting weird results.

By weird, I mean the date field (defined as date in the database), returns "Jan 4 2013 12:00am" as "Jan 4 2013". A 
field (defined as time in the database), returns "Jan 1 1900 5:00pm" as "5:00pm". In 32 bit, the dates return as 
"Jan 4 2013 12:00am" and "Jan 1 1900 5:00pm" respectively.
This same function works fine on the 32 bit side. It does work properly if a "convert(char(20, date)" is used in the query, but we don't want to change the code if possible. Without the convert, it is just pulling the date from a date column is chopping off the time when it is midnight. Also, if the date is 1/1/1900, its only outputting the time, without the date at all. We've tried multiple versions of DBD, still no luck. Any suggestions? I’m using DBD version 1.622 btw… Thanks! Mark Gerardi | Senior Software Engineer

Reply via email to