Re: [PHP-DB] Oracle date conversion

2002-01-11 Thread David C. Norris

Thanks for your response.  When I use SQL*Plus, I get full date+time.  I also get a 
full datetime from cx_Oracle (a
Python module).  Is this then a default _PHP_ behavior when querying an Oracle db?  
Why not return the full info?
Ordinarily, I would not complain about the small rewrite you suggest, but my 
application is an SQL query window in the
browser, aimed at users who are not SQL enthusiasts.

Thanks again,

David

Ford, Mike [LSS] wrote:

  -Original Message-
  From: David C. Norris [mailto:[EMAIL PROTECTED]]
  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: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


RE: [PHP-DB] Oracle date conversion

2002-01-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: David C. Norris [mailto:[EMAIL PROTECTED]]
 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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]