Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Auto-formatting...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 3464 of 3799
Post > Topic >>

Auto-formatting timestamps?

by pjkoczan@[EMAIL PROTECTED] ("Peter Koczan") May 13, 2008 at 10:58 AM

Hi all,

I'm undergoing a ****t from an old Sybase database to Postgres. It's
going surprisingly well, but I have a question regarding formatting of
timestamps.

In Sybase, we get:
:> select date from checkoutdate;
date
'May  1 2001 12:00AM'
....

In Postgres:
=> select date from checkoutdate;
       date
---------------------
 2001-05-01 00:00:00
....

I can properly format it using to_char:
=> select to_char(date, 'Mon DD YYYY HH:MIAM') as date from checkoutdate;
       date
---------------------
 May 01 2001 12:00AM
....

Short of creating a wrapper type for timestamp (which seems like
overkill just for modifying the output function), is there a way to
output the Sybase format automatically (i.e. without a call to
to_char)?

I've found some code that actually somewhat depends on this format,
and one of my goals in this ****t is to change as little client code as
possible. Is it possible to automatically change the output like this,
preferably on a per-connection basis? I found stuff regarding the
datestyle parameter in the docs, but that doesn't quite do what I'd
like.

Thanks much,
Peter

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 5 Posts in Topic:
Auto-formatting timestamps?
pjkoczan@[EMAIL PROTECTED  2008-05-13 10:58:25 
Re: Auto-formatting timestamps?
magawake@[EMAIL PROTECTED  2008-05-13 18:54:52 
Re: Auto-formatting timestamps?
pjkoczan@[EMAIL PROTECTED  2008-05-14 10:46:09 
Re: Auto-formatting timestamps?
alvherre@[EMAIL PROTECTED  2008-05-14 11:59:36 
Re: Auto-formatting timestamps?
magawake@[EMAIL PROTECTED  2008-05-14 22:46:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:44:05 CST 2008.