Date formatting

From: Mavka <mavka_temp(at)mail(dot)ru>
To: pgsql-docs(at)postgresql(dot)org
Subject: Date formatting
Date: 2016-04-28 18:07:53
Message-ID: 20160428110753.2700f00d@nikita_desk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

To convert a string to date I need to omit meaningless parts. I found
this format working well (Twitter dump format):

SELECT to_timestamp(
'Tue Sep 24 08:56:18 +0000 2013',
'xxx Mon DD HH24:MI:SS xxxxx YYYY'
)
-- 2013-09-24 08:56:18-07

In place of "xxx" I can use any non-reserved symbols, e.g.:

'aaa Mon DD HH24:MI:SS bbbbb YYYY'

Number of symbols can vary in some limits, e.g. 'aa' is still working.

Is it hack or normal behaviour of parser? I did not find any mention of
wildcards or placeholders in documentation:

http://www.postgresql.org/docs/9.5/static/functions-formatting.html

Best regards,
Mavka

P.S. I use PostgreSQL 9.4.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Kevin Grittner 2016-04-28 20:27:22 Re: COPY options
Previous Message Andrei M. Eichler 2016-04-28 16:58:22 COPY options