public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mavka <[email protected]>
To: [email protected]
Subject: Date formatting
Date: Thu, 28 Apr 2016 11:07:53 -0700
Message-ID: <20160428110753.2700f00d@nikita_desk> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-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.


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Date formatting
  In-Reply-To: <20160428110753.2700f00d@nikita_desk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox