Skip site navigation (1) Skip section navigation (2)

Re: SET DATESTYLE to time_t style for client libraries?

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Adam Haberlach <adam(at)newsnipple(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SET DATESTYLE to time_t style for client libraries?
Date: 2002-01-03 15:44:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
>         So I discovered today that pgdb follows in the traditional style of
> carrying timestamp and most other time fields through to the user as
> text strings, so I either need to have all my queries do some gymnastics
> to have the server format my time information in a way that is printable
> or can be handled by my client code or whatever.

Right. Though the available styles *should* cover common usage, and
ISO-8601 is not a bad way to go imho.

> Is there a better way?  I was thinking that if there was a way to set a
> datestyle that would just emit the seconds since the Unix epoch, I could
> kick them into the python time module's functions for easier formatting,
> and it would give all clients a more standardized way to deal with time
> by letting them get the 'raw' values and handle them locally.

Hmm. If the Python module has any date/time input routines, it *should*
be easy to ingest ISO-formatted dates. No? How about one of the other
available styles? If nothing else, you could go through to_char() to
format the date exactly as Python needs to see it (or directly for
display on your client apps). date_part('epoch'...) could get you Unix
system time, but that would last on my list...

                     - Thomas

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2002-01-03 15:51:06
Subject: Re: PGSQL - FAQ 4.1
Previous:From: Gavin SherryDate: 2002-01-03 15:27:03
Subject: Re: [HACKERS] Updated TODO item

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group