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: Date formats and Sybase
Date: Jul 9 2001 10:11PM

Arne Claassen writes:
 > Ok, this may be a newbie, rtfm sort of question, but every time i look up
 > the answer in the Sybase docs, i fail to believe it. Am i missing something
 > or is Sybase's date display format conversion about the most limited of any
 > DB? More to the point, unless i'm missing something there does not seem to
 > be a way to get the dates out in any format that will give date and time in
 > a 24 hour numerical only format, unless i do something like:
 > 
 >     convert(char(10), date_field, 111) + " " + convert(char(8), date_field,
 > 108)
 > 
 > Please, somebody tell me that I'm overlooking some obvious additional date
 > types or other way to get dates out of the DB.

That's about it.

But there are various ways to work on this. One fairly obvious way is
to create a view.

There are also ways of setting the default date display format via the
locale setting (although I've not really looked into that).

Mostly I tend to post-process the date format in perl. You can even
play around with things to extract an "epoch" based time
(i.e. something like a what time() returns) and pass that to
localtime/strftime/etc. 

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