dbTalk Databases Forums  

strptime string for timestamp with time zone

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss strptime string for timestamp with time zone in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul Makepeace
 
Posts: n/a

Default strptime string for timestamp with time zone - 12-25-2003 , 09:52 PM






Hi, I'm trying to create a time format string for strptime (GNU,
FWIW) that will parse an unmodifed timestamptz string. No luck with
Google yet.

In other words how to parse, e.g. "2003-12-26 03:15:36.633421+00".
"%Y-%m-%d %T" gets as far as the floating point section of the seconds
and bails.

(How does +\d\d represent half-hour timezones? If it was the usual
+\d{4} strptime's %z could at least use it.)

Or, perhaps some way of having PG return it in a strptime-friendly way?

Thanks, Paul

--
Paul Makepeace ................................ http://paulm.com/ecademy

"What is chutzpah? Look inside yourself."
-- http://paulm.com/toys/surrealism/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #2  
Old   
Harry Broomhall
 
Posts: n/a

Default Re: strptime string for timestamp with time zone - 12-26-2003 , 04:46 AM






Paul Makepeace writes:
Quote:
Hi, I'm trying to create a time format string for strptime (GNU,
FWIW) that will parse an unmodifed timestamptz string. No luck with
Google yet.

In other words how to parse, e.g. "2003-12-26 03:15:36.633421+00".
"%Y-%m-%d %T" gets as far as the floating point section of the seconds
and bails.

(How does +\d\d represent half-hour timezones? If it was the usual
+\d{4} strptime's %z could at least use it.)

Or, perhaps some way of having PG return it in a strptime-friendly way?

AFAIK - you can't do this simply. This is because struct tm does
not cater for fractional seconds. In addition (this is IMHO) neither
the C standard nor POSIX cater for time very well. The result
is that I always avoid having to parse such things by using the
various functions for timestamp offered by Postgres.

Regards,
Harry.



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: strptime string for timestamp with time zone - 12-26-2003 , 10:18 AM



Paul Makepeace <postgresql.org (AT) paulm (DOT) com> writes:
Quote:
Or, perhaps some way of having PG return it in a strptime-friendly way?
There's always to_char() ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.