How to select date and time from oracle date field using php date function

oracle, php, sql

Solution

According to the docs - http://docs.oracle.com/cd/B19306_01/server.102/b14220/datatype.htm#i1847 -

For input and output of dates, the standard Oracle date format is DD-MON-YY

That is most likely why `$last_login_details[FL_DATETIME]` is echoing `25-DEC-12`

Try changing your query using `TO_CHAR()`

SELECT TO_CHAR(FL_DATETIME, 'MM/DD/YYYY HH24:MI:SS A.M.') AS FL_DATETIME ...

see http://infolab.stanford.edu/~ullman/fcdb/oracle/or-time.html#date format

Problem

How to take the time from date stored as 12/25/2012 5:12:05 AM . ``` date('l F j, Y, g:i a',strtotime($last_login_details[FL_DATETIME])); ``` This above function returned time as 12:00 am which should return 5:12AM. FL_DATETIME has datatype DATE. On database, the value is being stored like this : ``` 12/25/2012 5:12:05 AM ```

Original source