Re: Postgres RFC3339 datetime formatting - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Postgres RFC3339 datetime formatting
Date
Msg-id A737B7A37273E048B164557ADEF4A58B5384D8EA@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Postgres RFC3339 datetime formatting  (Jasim Mohd <hello@jasimmk.com>)
List pgsql-general
Jasim Mohd wrote:
> Is there any way to format datetime to RFC3339Nano Eg: 2006-01-02T15:04:05.999999999Z07:00 in postgres
> 9.3 or 9.5?
> 
> I tried with to_char. But there is no documentation how to handle T, Z, +07:00, -07:00 etc.

The best I can get is:

SELECT to_char(current_timestamp, 'FXYYYY-MM-DD"T"HH:MI:SS.US"000Z"OF');

but it will suppress the minute part of the time zone offset if it is 0.

I don't think you can get nanosecond precision in PostgreSQL.

Is that good enough?

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Roman Khalupa
Date:
Subject: Build postgresql
Next
From: John McKown
Date:
Subject: Re: Postgres RFC3339 datetime formatting