Link to home
Start Free TrialLog in
Avatar of nickel2001
nickel2001

asked on

Shot in the dark

Hi All:

I am working with an OLE application which data can be manipulated with javascript. I have as a database native date format 1,049,200,679 For example.
This corresponds to  01-APR-2003 06:37:26.
My goal is to substract two such dates and return the number of month, days, hours and seconds in between.
I think that the easiest would be to work with the 1,049,200,679 format. For example: If I substract, 1,049,200,679 with  1,049,200,604 (01-APR-2003 06:36:44), I get  75. Now the question is....
How do I convert this 75 into a month,days, hours and seconds format.

Thanks!
Nickel
Avatar of dakyd
dakyd

Are you sure that 1,049,200,679 corresponds to 01-APR-2003 06:37:26?  The reason I ask is that those numbers look suspiciously close to the number of seconds since Jan 1, 1970 00:00:00.  Here's a little test script I wrote that illustrates this fact:

<script type="text/javascript">
var date = new Date(1049200679*1000);     // expects argument is in ms, multiply by 1000
var date2 = new Date(1049200604*1000);

document.write(date + "<br />" + date2);
</script>

When I did that, I got:
Tue Apr 1 04:37:59 PST 2003
Tue Apr 1 04:36:44 PST 2003

Hence my question, that seems way too close to be a coincidence.  If that's the case, then the difference between any two given numbers is equal to the number of seconds between those two dates.  It's also a bit of a stab in the dark, but hope it helps.
Avatar of nickel2001

ASKER

You are right. My assumptions about the format were wrong.
How do I go from the numbers of seconds between the two dates to a
days, hours, minutes format?

Thanks a lot for tackling this.

Nickel
ASKER CERTIFIED SOLUTION
Avatar of dakyd
dakyd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great. I'll check it out.

Thanks a lot,
Nickel