pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to_timestamp, problem
2+ messages / 2 participants
[nested] [flat]

* to_timestamp, problem
@ 2000-12-15 10:30 Marcin Mazurek <M.Mazurek@poznan.multinet.pl>
  2000-12-15 10:49 ` Re: to_timestamp, problem Karel Zak <zakkr@zf.jcu.cz>
  0 siblings, 1 reply; 2+ messages in thread

From: Marcin Mazurek @ 2000-12-15 10:30 UTC (permalink / raw)
  To: pgsql-sql

Hi,
Can anyone explain to me why this doesn't work. Seems to be some stupid (my)
mistake:

mtldb=# SELECT  to_timestamp('05121445482000', 'MMDDHHMISSYYYY');
      to_timestamp
------------------------
 2000-05-12 14:45:48+02
(1 row)

mtldb=# SELECT  to_timestamp('20000512144548', 'YYYYMMDDHHMISS');
 to_timestamp
--------------
 invalid
(1 row)

pg 7.0.3, linux 2.2

tia
mazek

Marcin Mazurek

--  
Kierownik DziaƂu Systemowego
MULTINET SA o/Poznan
http://www.multinet.pl/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: to_timestamp, problem
  2000-12-15 10:30 to_timestamp, problem Marcin Mazurek <M.Mazurek@poznan.multinet.pl>
@ 2000-12-15 10:49 ` Karel Zak <zakkr@zf.jcu.cz>
  0 siblings, 0 replies; 2+ messages in thread

From: Karel Zak @ 2000-12-15 10:49 UTC (permalink / raw)
  To: Marcin Mazurek <M.Mazurek@poznan.multinet.pl>; +Cc: pgsql-sql


On Fri, 15 Dec 2000, Marcin Mazurek wrote:

> Hi,
> Can anyone explain to me why this doesn't work. Seems to be some stupid (my)
> mistake:
> 
> mtldb=# SELECT  to_timestamp('05121445482000', 'MMDDHHMISSYYYY');
>       to_timestamp
> ------------------------
>  2000-05-12 14:45:48+02
> (1 row)
> 
> mtldb=# SELECT  to_timestamp('20000512144548', 'YYYYMMDDHHMISS');
>  to_timestamp
> --------------
>  invalid
> (1 row)
> 
> pg 7.0.3, linux 2.2


 You are right. It is already know bug (feature:-) in 7.0.x, in this
version, to_timestamp() expect that year not must be exactly 
4-digits but can be greater. A solution is use some separator like
'YYYY-MMDDHHMISS' or use YYYY as last in format template (as in your 
first example).

 In 7.1 is better analyse that fix it: 

test=# SELECT version();
                             version
------------------------------------------------------------------
 PostgreSQL 7.1devel on i686-pc-linux-gnu, compiled by GCC 2.95.2
(1 row)

test=# SELECT to_timestamp('20000512144548', 'YYYYMMDDHHMISS');
      to_timestamp
------------------------
 2000-05-12 14:45:48+02
(1 row)

					Karel
 




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-12-15 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-15 10:30 to_timestamp, problem Marcin Mazurek <M.Mazurek@poznan.multinet.pl>
2000-12-15 10:49 ` Karel Zak <zakkr@zf.jcu.cz>

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