note 14095 deleted from ref.datetime by victor
| From: | victor@php.net | Date: | Mon, 09 Dec 2002 18:50:24 +0000 |
| Subject: | note 14095 deleted from ref.datetime by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40608@lists.php.net to get a copy of this message | ||
For those who want portable timestamps between ODBC-compliant datasources, use the following format:
{ts '1890-12-30 00:00:00'}
(The above timestamp is associated as the "zero-base" in many datasources)
So, to use the above timestamp in a query, do something like this:
INSERT INTO MyTable (Table_ID, Table_TS)
VALUES (1, {ts '1890-12-30 00:00:00'})
If you just want to use the date, use this:
{d '1890-12-30'}
Or just the time:
{t '00:00:00'}
That should ease someone's pain. Instead of running a query against the database for a
timestamp (which is generally slow), you can generate one real-time. For instance:
echo "{ts '".gmdate("Y-m-d h:i:s", time())."'}";
It is just a matter of modifying the above code for whatever queries you need to perform.
MacTruck
(BTW, if you can't tell, those are braces '{}' rather than parenthesis '()'
surrounding the timestamp...they are also known as "escape characters" in ODBC
terminology).