to_json(now()) result doesn't have 'T' separator

From: Joe Van Dyk <joe(at)tanga(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: to_json(now()) result doesn't have 'T' separator
Date: 2013-12-21 00:18:59
Message-ID: CACfv+pLxT+YYJxFS2hwYrvu==FsGV4Ross7gj9bcgbEsyrfOjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

# select to_json(now());
to_json
---------------------------------
"2013-12-20 15:53:39.098204-08"
(1 row)

I'd like to see it output "2013-12-20T15:53:39.098204-08" so it's
interchangeable with more systems.

http://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representationssays
'T' can be omitted "by mutual agreement".

I'm working with javascript/json systems that expect the 'T' to be there
however, so there's no mutual agreement happening.

Thoughts? I know I can hack around it by specifying my own date format, but
I'd really like to be able to use row_to_json and other functions without
specifying custom date formats everywhere.

Joe

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-12-21 00:20:17 Re: Seems like bug in 9.1.3, need to confirm.
Previous Message David Johnston 2013-12-21 00:15:43 Re: Seems like bug in 9.1.3, need to confirm.