.Net datetime comparisons to Javas getMilliseconds UTC time

T

Tim Greenwood

I don't seem to be able to find anything in .NET that will return a value
that I can compare to this. I'm being passed the msec from the java call
and need to compare it to my system date for security reasons. How can I go
about this? How to get an equivalent in .NET or convert the java value to
something usable?

Any help is greatly appreciated. We have a security person hired in for 3
days and today is his last day. He knows nothing of .NET and can't really
help.
 
T

Tim Greenwood

Hmmm I believe that is just the HH.MM.SS.mm millisecond part within the
passing second of the current time is it not? IOW it will never be greater
than 999....
 
S

Stephany Young

DateTime.UtcNow.Ticks / 10000 (number of 100 nanosecond intervals in a
millisecond)
 
T

Tim Greenwood

Nope......NET UTC is returning ticks based on a date of January 1, 1 C.E.
not 1970 greenwich meantime.
But, knowing the date I figured it out.
TimeSpan ts =
System.DateTime.Now.Subtract(System.Convert.ToDateTime("1/1/1970 00:00:01
am"));
ts.TotalMilliseconds is the answer !

Thanks to all who replied
 

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

Top