Re: Newbie timestamp question
От | Bruno Wolff III |
---|---|
Тема | Re: Newbie timestamp question |
Дата | |
Msg-id | 20040317191954.GA16639@wolff.to обсуждение исходный текст |
Ответ на | Newbie timestamp question ("Robin 'Sparky' Kopetzky" <sparkyk@blackmesa-isp.net>) |
Список | pgsql-general |
On Wed, Mar 17, 2004 at 11:52:19 -0700, Robin 'Sparky' Kopetzky <sparkyk@blackmesa-isp.net> 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 certainly couldn't have it as an integer. Even as type unknown (which you get by quoting the constant) it doesn't work. You can use to_timestamp to convert the string. For example: bruno=> select to_timestamp('19990108040506', 'YYYYMMDDHH24MISS'); to_timestamp ------------------------ 1999-01-08 04:05:06+00 (1 row)
В списке pgsql-general по дате отправления: