RE: [PHP-DB] Oracle date conversion
| From: | Ford, Mike [LSS] | Date: | Tue, 08 Jan 2002 13:58:52 +0000 |
| Subject: | RE: [PHP-DB] Oracle date conversion | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15526@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: David C. Norris [mailto:dnorris@mitre.org]
> Sent: 26 December 2001 17:00
>
> Oracle DATEs are retrieved (by ora_fetch_into($cursor, $row,
> ORA_FETCHINTO_NULLS), for example) as plain dates (e.g., '26-DEC-01'),
> losing the time of day (as in '26-DEC-01 12:34:56'). Is this
> a bug?
No, this is the default ORACLE format for retrieved dates.
> Is
> there a workaround that doesn't involve rewriting the query?
No, but modifying the query to use a date format is actually the best solution. This would give you
something like:
SELECT TO_CHAR(DATE, 'DD-MON-YY HH:MI:SS') AS DATE_TIME FROM TBL
Look up the definition of the TO_CHAR function for the full list of format elements available for
formatting DATEs.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211