From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Robin 'Sparky' Kopetzky <sparkyk(at)blackmesa-isp(dot)net> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Newbie timestamp question |
Date: | 2004-03-17 19:19:54 |
Message-ID: | 20040317191954.GA16639@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Mar 17, 2004 at 11:52:19 -0700,
Robin 'Sparky' Kopetzky <sparkyk(at)blackmesa-isp(dot)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)
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2004-03-17 21:35:49 | Re: Data Corruption in case of abrupt failure |
Previous Message | Richard Huxton | 2004-03-17 19:09:20 | Re: Newbie timestamp question |