|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: DBD::Sybase ISO date format returns January as "00"?!!
Date: Jan 27 2005 3:27PM
On Thu, 2005-01-27 at 13:54, cameron.mellor@jpmorgan.com wrote:
> Sorry if this is trivial but I've done as much Googling as I can stand
> without having turned up anything relevant.
>
> I'm using "ISO" date format on a Sybase $dbh, but the month numbers are
> coming back zero based (January is "00"). As I read ISO 8601 it *should* be
> "01". Any clues? For example:
I'm deeply embarrassed by this one. It's an off-by-one error in the
formating: DBD::Sybase uses the cs_dt_crack() call to split the datetime
value into its components, and the docs clearly state that the month is
in the 0-11 range (just as it is with gmtime/localtime() in C or perl).
You can fix this easily: edit dbdimp.c, and around like 4450 you'll see
the cs_dt_crack() call, followed by the sprintf() calls that format the
date. Add 1 to then rec.datemonth argument to sprintf() and you'll be
fine.
It'll obviously be fixed in the next release...
Michael
--
Michael Peppler - mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
|