Home All Groups Group Topic Archive Search About

Convert today's date and time to a long

Author
29 Nov 2006 3:21 PM
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?

Author
29 Nov 2006 4:18 PM
Tom Shelton
Holmsey wrote:
> 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 Shelton
Author
29 Nov 2006 6:49 PM
Holmsey
Tom Shelton wrote:
> Holmsey wrote:
> > 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 Shelton

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).)
Author
29 Nov 2006 7:27 PM
Holmsey
Tom Shelton wrote:
> Holmsey wrote:
> > 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 Shelton

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).)
Author
29 Nov 2006 8:18 PM
Tom Shelton
Holmsey wrote:
Show quoteHide quote
> Tom Shelton wrote:
> > Holmsey wrote:
> > > 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 Shelton
>
> 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)