Re: Convert a UNIX timestamp in a PostgreSQL INSERT statement
| От | Richard Brooksby |
|---|---|
| Тема | Re: Convert a UNIX timestamp in a PostgreSQL INSERT statement |
| Дата | |
| Msg-id | 53A6CEBC-8642-11D8-97F4-000393D3C042@ravenbrook.com обсуждение исходный текст |
| Ответ на | Convert a UNIX timestamp in a PostgreSQL INSERT statement ("Alan T. Miller" <amiller@hollywood101.com>) |
| Ответы |
Re: Convert a UNIX timestamp in a PostgreSQL INSERT statement
|
| Список | pgsql-novice |
On 4 Apr 2004, at 12:08, Alan T. Miller wrote: > I have a PHP script that captures the time using the PHP time() > function. I > want to insert this time into a postgresql table timestamp field. I am > at a > loss on how to do this. ... If you have a Unix-style timestamp (seconds since 1970-01-01 00:00) you can convert it to a PostgreSQL timestamp like this: select timestamp '1970-01-01' + interval '953559481 seconds'; There might be a better way, but that's how I solved it. --- Richard Brooksby <rb@ravenbrook.com> Senior Consultant Ravenbrook Limited <http://www.ravenbrook.com/> PO Box 205, Cambridge CB2 1AN, United Kingdom Voice: +44 777 9996245 Fax: +44 870 1641432
В списке pgsql-novice по дате отправления: