Obtain .NET "Ticks" from J2EE "Millis"

Obtain .NET "Ticks" from J2EE "Millis"

Post by num » Wed, 18 Feb 2004 18:39:35


Hi all,

Sorry for cross-posting.

I have to convert a J2EE date as a long ("Millis") in a .NET date as a
long ("Ticks")

In Java, currentTimeMillis, is the difference, measured in
milliseconds, between the current time and midnight, January 1, 1970
UTC.

In .NET, DateTime.Ticks is the 100-nanosecond intervals that have
elapsed since 12:00 A.M., January 1, 0001 (!!!)

So, I think that the formula is:
------------------------------------------------------------------
| T = t * 10E4 + 621 355 968 000 000 000 |
| "Ticks .NET" "Millis Java" |
------------------------------------------------------------------

Correct or not?

Cheers,

Num
 
 
 

Obtain .NET "Ticks" from J2EE "Millis"

Post by Actio » Thu, 19 Feb 2004 00:33:00

What I do:
new DateTime(new DateTime(1970, 1, 1).Tick + javatime)

 
 
 

Obtain .NET "Ticks" from J2EE "Millis"

Post by num » Thu, 19 Feb 2004 19:39:12


Ok, it's another way...

thanks for your answer

Num,