Convert today's date and time to a long

H

Holmsey

Hi I have to convert am today's date and time (now) to a webservice.
The example the web service gives was "1163313527144#" which comes out
to 12/31/1969 06:00 PM. How do I convert a date to a 13 digit long
value?
 
T

Tom Shelton

Holmsey said:
Hi I have to convert am today's date and time (now) to a webservice.
The example the web service gives was "1163313527144#" which comes out
to 12/31/1969 06:00 PM. How do I convert a date to a 13 digit long
value?

what format is that? There are lots of ways to represent a date as a
long value...
 
H

Holmsey

Tom said:
what format is that? There are lots of ways to represent a date as a
long value...

Im am trying to figure out todays date as a long value from (A
millisecond value that is an offset from the Epoch, January 1, 1970
00:00:00.000 GMT (Gregorian).)
 
H

Holmsey

Tom said:
what format is that? There are lots of ways to represent a date as a
long value...

Im am trying to figure out todays date as a long value from (A
millisecond value that is an offset from the Epoch, January 1, 1970
00:00:00.000 GMT (Gregorian).)
 
T

Tom Shelton

Holmsey said:
Im am trying to figure out todays date as a long value from (A
millisecond value that is an offset from the Epoch, January 1, 1970
00:00:00.000 GMT (Gregorian).)

Ok... How 'bout:

Dim epoch As New DateTime (1970, 1, 1, 0, 0, 0, 0)
Dim diff As TimeSpan = DateTime.Now.Subtract (epoch)
Dim ms As Long = CType (diff.TotalMilliseconds, Long)
Console.WriteLine (ms)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top