Re: [GENERAL] Timestamp <-> ctime conversion question ...

2005-12-15 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > That said, you need to be careful about testing this using psql. I > believe psql is what's converting the timestamp to your local timezone. Certainly not; psql doesn't even know what a timestamp is. If you get different results in a different client i

Re: [GENERAL] Timestamp <-> ctime conversion question ...

2005-12-15 Thread Jim C. Nasby
First, I don't think the epoch conversion has anything to do with this, so it'd be better to focus on simple timestamps. That said, you need to be careful about testing this using psql. I believe psql is what's converting the timestamp to your local timezone. If you test this using a different int

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-14 Thread Alex Mayrhofer
Martijn van Oosterhout wrote: On Tue, Dec 13, 2005 at 08:21:20PM +0100, Karsten Hilbert wrote: Presumably this would allow timestamps to be displayed with a timezone other than the current setting. *Display* of timestamptz values at arbitrary time zones is already possible using the "at time zo

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-14 Thread Martijn van Oosterhout
On Tue, Dec 13, 2005 at 08:21:20PM +0100, Karsten Hilbert wrote: > > Presumably this would allow timestamps to be displayed with a > > timezone other than the current setting. > *Display* of timestamptz values at arbitrary time zones is > already possible using the "at time zone" syntax. Retrieving

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > On Dec 14, 2005, at 2:49 , Tom Lane wrote: >> There is a built-in function to_timestamp() equivalent to this in 8.1, >> though it doesn't seem to have made it into the documentation :-( > It's in 9.8. Data Type Formatting Functions Yeah, I found it

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Michael Glaesemann
On Dec 14, 2005, at 2:49 , Tom Lane wrote: There is a built-in function to_timestamp() equivalent to this in 8.1, though it doesn't seem to have made it into the documentation :-( It's in 9.8. Data Type Formatting Functions http://www.postgresql.org/docs/current/interactive/functions- format

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Karsten Hilbert
On Tue, Dec 13, 2005 at 12:34:19PM -0700, Michael Fuhr wrote: > > *Display* of timestamptz values at arbitrary time zones is > > already possible using the "at time zone" syntax. > > But the result is a timestamp without time zone and thus doesn't > display the target time zone. In other words,

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Michael Fuhr
On Tue, Dec 13, 2005 at 08:21:20PM +0100, Karsten Hilbert wrote: > On Tue, Dec 13, 2005 at 10:28:42AM -0700, Michael Fuhr wrote: > > As far as I know there isn't a way to defeat this. However, the > > developers' TODO file does have the following item: > > > > Allow TIMESTAMP WITH TIME ZONE t

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Karsten Hilbert
On Tue, Dec 13, 2005 at 10:28:42AM -0700, Michael Fuhr wrote: > According to the Date/Time Types documentation, > > All timezone-aware dates and times are stored internally in UTC. > They are converted to local time in the zone specified by the > timezone configuration parameter befor

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Tom Lane
Alex Mayrhofer <[EMAIL PROTECTED]> writes: > i'm trying to convert time stamps to "seconds since epoch" and back. > test=# SELECT (TIMESTAMP WITH TIME ZONE 'epoch' > + 0 * INTERVAL '1 second') AT TIME ZONE 'UTC'; You're overthinking the problem. It should be just SELECT

Re: [GENERAL] timestamp <-> ctime conversion question...

2005-12-13 Thread Michael Fuhr
On Tue, Dec 13, 2005 at 05:31:49PM +0100, Alex Mayrhofer wrote: > i'm trying to convert time stamps to "seconds since epoch" and back. My > original timestamps are given with a time zone (UTC), and i have a > conversion function to "ctime" which works pretty well: > > CREATE OR REPLACE FUNCTION