S
Shane Saunders
I trying to make a sub that works like Javascripts .getTime method. It work
ok, but it does not should the time in it. The last numbers should be the
time, but they are all zeros. Can anyone help me on this. here is the code i
used. From reading i also seen that the getTime time starts on 01/01/1970
12am. I need to have this in Millsecond.
VB.net Code:
Dim days As Long
Dim date1970 As Date = "#1/1/1970 12:00:00 AM#"
Dim datenow As Date = Date.Now
Dim mseconds As Long = 60 * 60 * 24 * 1000
days = DateDiff(DateInterval.DayOfYear, date1970, datenow)
days = days * mseconds
Label1.Text = days
Output:
6/6/2004 10:02:35 AM
1086480000000
JavaScript Code:
var uniquej = new Date();
var uniquei = "?"+uniquej.getTime();
document.write(uniquej)
document.write("<br>")
document.write(uniquei)
Output:
Sun Jun 6 10:00:20 PDT 2004
?1086541220672
The outputs are almost the same, but i need them to the same. Is there a way
to run that javascript code in vb.net and just pass the value back a
variable?
Shane
ok, but it does not should the time in it. The last numbers should be the
time, but they are all zeros. Can anyone help me on this. here is the code i
used. From reading i also seen that the getTime time starts on 01/01/1970
12am. I need to have this in Millsecond.
VB.net Code:
Dim days As Long
Dim date1970 As Date = "#1/1/1970 12:00:00 AM#"
Dim datenow As Date = Date.Now
Dim mseconds As Long = 60 * 60 * 24 * 1000
days = DateDiff(DateInterval.DayOfYear, date1970, datenow)
days = days * mseconds
Label1.Text = days
Output:
6/6/2004 10:02:35 AM
1086480000000
JavaScript Code:
var uniquej = new Date();
var uniquei = "?"+uniquej.getTime();
document.write(uniquej)
document.write("<br>")
document.write(uniquei)
Output:
Sun Jun 6 10:00:20 PDT 2004
?1086541220672
The outputs are almost the same, but i need them to the same. Is there a way
to run that javascript code in vb.net and just pass the value back a
variable?
Shane