Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date format is unreadable
to_date('01/01/1970', 'MM/DD/YYYY') + time_stamp / 86400
is a DATE expression
formatting of DATE values is done with the TO_CHAR function (see SQL
Reference Manual)
for example:
to_char (to_date('01/01/1970', 'MM/DD/YYYY') + time_stamp / 86400,
'YYYY/MM/DD HH24:MI:SS')
-----Original Message-----
Sent: vendredi, 7. mars 2003 13:24
To: Multiple recipients of list ORACLE-L
It works better but it still does give correct output. I'd like to see hour,min,sec as well.
1 select user_name,node_name,to_date('01/01/1970', 'MM/DD/YYYY') + time_stamp / 86400 from user_activity_log 2 from user_activity_log
3 where user_name = 'admin'
4* order by time_stamp
SQL> / USER_NAME NODE_NAME TO_DATE('
admin Insight Server 01-MAY-19 admin Insight Server 11-MAY-03 admin Insight Server 11-NOV-01 admin Insight Server 24-DEC-13
Thanks,
David
-----Original Message-----
Sent: Wednesday, March 05, 2003 4:40 PM
To: Multiple recipients of list ORACLE-L
Ooops. Should have written
to_date('01/01/1970', 'MM/DD/YYYY') + TIME_STAMP / 86400
The timestamp is in seconds since 1/1/1970, while Oracle date arithmetic
is in days.
Sorry.
"Nguyen, David M" wrote:
>
> Yes, it is a Unix timestamp. I use your syntax and I got following error.
>
> 1 select
> user_name,client_ip,node_name,to_date('01/01/1970','MM/DD/YYYY')+tig
> 2 where user_name = 'admin'
>
> 3* order by time_stamp
>
> SQL> /
>
> select user_name,client_ip,node_name,to_date('01/01/1970','MM/DD/YYYY') +
> time_stamp from user_activity_log
> *
>
> ERROR at line 1:
>
> ORA-01841: (full) year must be between -4713 and +9999, and not be 0
>
>
>
> -----Original Message-----
> Sent: Wednesday, March 05, 2003 3:25 PM
> To: Multiple recipients of list ORACLE-L
>
> David,
>
> I presume that your date is a Unix timestamp.
>
> Try to see whether
>
> to_date('01/01/1970', 'MM/DD/YYYY') + TIME_STAMP
>
> yields something more meaningful to you ...
>
> --
> Regards,
>
> Stephane Faroult
> Oriole Software
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Faroult INET: sfaroult_at_oriole.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jacques Kilchoer INET: Jacques.Kilchoer_at_quest.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Fri Mar 07 2003 - 16:18:46 CST
![]() |
![]() |