0

In Oracle, how can I find find the duration of time in UNIX format between two dates in TIMESTAMP format?

START_DATE                END_DATE                   DURATION
    "2014-08-07 10:02:39.0",  "2014-08-07 10:07:08.0"    ???UNIX FORMAT
vasili111
  • 6,032
  • 10
  • 50
  • 80
Ivan Smorodin
  • 151
  • 3
  • 14

1 Answers1

0

You would do the following in PHP.

$start_date = strtotime("2014-08-07 10:02:39.0");
$end_date = strtotime("2014-08-07 10:07:08.0");

$duration = $end_date - $start_date;

Unix "format" or Unix Timestamp is all the seconds leading from 1970-01-01, till the date it's pointing at. So all the seconds from 1970-01-01 to 2014-08-07 10:02:39.0 for e.g.;

strtotime(); is a PHP Function

That converts "virtually" any given string representation of a date, into a Unix Timestamp.

After you've converted your dates into Unix Timestamps and subtracted them accordingly, what you have left with are the seconds that have passed between 2014-08-07 10:02:39.0 and 2014-08-07 10:07:08.0

Hope that helps.

Zander Rootman
  • 2,178
  • 2
  • 17
  • 29