Convert today's date and time to a long

  • Thread starter Thread starter Holmsey
  • Start date Start date
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?
 
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...
 
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).)
 
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).)
 
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)
 
Back
Top