Re: seconds from midnight into a date field?

  • From: "Carel-Jan Engel" <cjpengel.dbalert@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Mon, 12 Jul 2004 15:15:09 +0200 (CEST)

A day has 86400 seconds. I presume your seconds-column ranges from 0 to
86400. Date expressions support fractions.

Your conversion function should be something like:

TO_DATE(TRUNC(SYSDATE /* or the day you want it to be */) +
TO_NUMBER(your_column_with_seconds) / 86400)


Regards, Carel-Jan

===
If you think education is expensive, try ignorance. (Derek Bok)
===



> I have a varchar field that I need to migrate to a date field. it is in
> the form 'seconds from midnight' and looks like this
> 0001
> 0050
> 1054
> I can't find a to_date function to translate that. do any exist?
>
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at //www.freelists.org/archives/oracle-l/
> FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------
>

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: