473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
Jul 21 '05 #1
1 3581
This was covered on another forum also.

This conversion code is valid.
--------------------
| From: nu*@laposte.net (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: <28**************************@posting.google.com >
| 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: gr**********@google.com
| NNTP-Posting-Date: Fri, 13 Feb 2004 15:05:02 +0000 (UTC)
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.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
|

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Richard | last post by:
Hi all, Hope everybody is having an OK monday?!!? Quick question, I have a database in which the dates are stored as longs. I think the original program was VB and the dates were just cast...
3
by: sparkle | last post by:
Hi, Does anybody know how to convert date to ticks from a dateTimePicker? What I'm using now isn't working. I'm trying to use a dateTimePicker to set an appointment in Outlook with a...
2
by: yxq | last post by:
There are 8 bytes binary value stored date and time in Registry. 84 8B D7 DF 8B 28 C5 01 I want to convert the binary value to date using VB.NET. Dim a As FILETIME a.dwHighDateTime = 29698187...
2
by: Num | last post by:
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...
2
by: Num | last post by:
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...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
4
by: Holmsey | last post by:
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...
6
by: chandanlinster | last post by:
what do the values of "clocks_ticks = sysconf(_SC_CLK_TCK);" and "CLOCK_PER_SEC" represent?
3
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.