Re: strptime string for timestamp with time zone

From: Harry Broomhall <harry(dot)broomhall(at)uk(dot)easynet(dot)net>
To: postgresql(dot)org(at)paulm(dot)com (Paul Makepeace)
Subject: Re: strptime string for timestamp with time zone
Date: 2003-12-26 10:46:30
Message-ID: 200312261051.KAA34548@haeb.noc.uk.easynet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Paul Makepeace writes:
> 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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-12-26 16:18:29 Re: strptime string for timestamp with time zone
Previous Message Paul Makepeace 2003-12-26 03:52:42 strptime string for timestamp with time zone