pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mavka <mavka_temp@mail.ru>
To: pgsql-docs@postgresql.org
Subject: Date formatting
Date: Thu, 28 Apr 2016 11:07:53 -0700
Message-ID: <20160428110753.2700f00d@nikita_desk> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?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 (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (2+ messages)  latest in thread

Message-ID: <20160428110753.2700f00d@nikita_desk>
Permalink:  ../20160428110753.2700f00d@nikita_desk/
Also on:    postgresql.org/message-id/20160428110753.2700f00d@nikita_desk

 · 

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: pgsql-docs@postgresql.org
  Cc: mavka_temp@mail.ru
  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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox