How to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks")?

N

Num

Hi all,

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
 
A

Anthony Moore

This was covered on another forum also.

This conversion code is valid.
--------------------
| From: (e-mail address removed) (Num)
| Newsgroups: microsoft.public.dotnet.general
| Subject: How to convert a J2EE date as a long ("Millis") in a .NET date
as a long ("Ticks")?
| Date: 13 Feb 2004 07:05:02 -0800
| Organization: http://groups.google.com
| Lines: 23
| Message-ID: <[email protected]>
| NNTP-Posting-Host: 195.68.44.199
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1076684702 10167 127.0.0.1 (13 Feb 2004
15:05:02 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Fri, 13 Feb 2004 15:05:02 +0000 (UTC)
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.icl.net!newsfeed.fj
serv.net!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:124588
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hi all,
|
| 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
|
 

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