Re: to_timestamp, problem
От | Karel Zak |
---|---|
Тема | Re: to_timestamp, problem |
Дата | |
Msg-id | Pine.LNX.3.96.1001215114202.4543A-100000@ara.zf.jcu.cz обсуждение исходный текст |
Ответ на | to_timestamp, problem (Marcin Mazurek <M.Mazurek@poznan.multinet.pl>) |
Список | 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 GCC2.95.2 (1 row) test=# SELECT to_timestamp('20000512144548', 'YYYYMMDDHHMISS'); to_timestamp ------------------------2000-05-12 14:45:48+02 (1 row) Karel
В списке pgsql-sql по дате отправления: