realbasic-nug
[Top] [All Lists]

Re: Java date to RB date

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Java date to RB date
From: Norman Palardy <palardyn at shaw dot ca>
Date: Sun, 31 Oct 2004 21:31:14 -0700
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <645DE11E-2B9F-11D9-B648-00039346A7A8 at mac dot com> <115E6521-2BA5-11D9-AB39-000393786770 at realsoftware dot com>

On Oct 31, 2004, at 6:26 PM, Geoff Perlman wrote:

When you assign the value to the TotalSeconds property, I believe it's going override the day, month and year values you've assigned. I'm surprised the values you are getting are so close together. That's probably just a coincidence. Don't bother setting the day, month and year properties. Instead, assign to TotalSeconds the number of seconds between January 1st, 1904 (the base data for REALbasic dates) and January 1st, 1970 (the base Java date) plus the milliseconds you parsed converted to seconds.
That should do it.

That's IS what this should do

dte = new Date()
dte.Day = 1
dte.Month = 1
dte.Year = 1970
dte.Hour = 0
dte.Minute = 0
dte.Second = 0

// dte.totalseconds is the total number of seconds between Jan 1, 1904 and Jab 1, 1970
// and add the millis since 1970

dte.TotalSeconds = dte.TotalSeconds + Val(millis) / 1000

I'd bet you just need to make the division / 1000.0 to get this to work out right

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>