PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: dbd::sybase datetime format
Date: Apr 1 2002 6:55PM

Stephen.Sprague@morganstanley.com writes:
 > Hi folks-
 > 
 > Given Sybase::DBD version 0.94 I see Michael has provided us  with  ways
 > to  change  the  default  format  of  dates  via  the   $dbh->func($fmt,
 > '_date_fmt') callback.
 > 
 > Very nice.
 > 
 > However, if none the given ones suit  me  I'm  forced  to  go  thru  the
 > statement handle's NAMES/TYPES and do a conversion  from  there  slowing
 > down the process greatly.
 > 
 > How picky would it be to ask for 'YYYYMMDD HH:MM:SS'? Or  better  yet  a
 > callback whereby I could contruct the date myself if sent the parts, ala
 > perl's localtime?

Something like strftime(), maybe?

This could work like this:

$dbh->{syb_date_fmt} = "%c";

and DBD::Sybase would call strftime() on incomming
datetime/smalldatetime datatypes.

Limitations are the limitations of struct tm (hence the limitations of
the time_t C type, currently from jan 1 1970 to some date in
2038). Behaviour for dates outside of that range might get
"interesting"...

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org           *or*          mpeppler@mbay.net
http://www.mbay.net/~mpeppler
International Sybase User Group: http://www.isug.com