Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Seconds to Datetime value 1

Status
Not open for further replies.

9654

Programmer
Aug 4, 2003
34
0
0
US
I have a number column which has value in the form of number of seconds since 1 jan 1970.
Please suggest a select and not a fnction which would allow me to use dateadd or similar function to get a date out of the number field.

Eg. the value in the number column representing the no. of seconds since 1 1 1970 is 1122568480 which is really
7/28/2005 4:34:40PM

Please suggest select and no functions.
 
select (to_date('01-JAN-1970') + 1122568480/86400) from dual

This gives you the date and time you mention above.

Just replace 1122568480 with the field name and you will have a date

 
Thanks for the reply.
I also got a similar solution which is

select
to_date('01/JAN/1970')+numtodsinterval(1122568480,'second') from dual

where the second can be changed to minute or hour as needed dependant on the data stored.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top