Re: Newbie timestamp question

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: Newbie timestamp question
Дата
Msg-id Pine.LNX.4.33.0403171200140.11180-100000@css120.ihs.com
обсуждение исходный текст
Ответ на Newbie timestamp question  ("Robin 'Sparky' Kopetzky" <sparkyk@blackmesa-isp.net>)
Список pgsql-general
On Wed, 17 Mar 2004, Robin 'Sparky' Kopetzky wrote:

> Good Morning!!
>
>     I'm repairing a series of scripts in PHP that use the 'datetime' of MySQL
> and converting them to Postgres. Question is this: The datetime format used
> in the script is 'YYYYMMDDHHMMSS' as a text string. Do I have to convert
> this to the format shown in the Postgres manual: '1999-01-08 04:05:06' for
> Postgres to accept the value or can I just pass an integer as 19990108040506
> for the timestamp?

You can just seperate the date part from the time part with a space and it
will work:

postgres=# create table test (dt timestamp);
CREATE TABLE
postgres=# insert into test values ('20020202121410');
ERROR:  invalid input syntax for type timestamp: "20020202121410"
postgres=# insert into test values ('20020202 121410');
INSERT 20297173 1
postgres=# select * from test;
         dt
---------------------
 2002-02-02 12:14:10


В списке pgsql-general по дате отправления:

Предыдущее
От: "Valter"
Дата:
Сообщение: Re: Relation "xxxxx" does not exist - more info
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Newbie timestamp question