473,569 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, currentTimeMill is, 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 3606
This was covered on another forum also.

This conversion code is valid.
--------------------
| From: nu*@laposte.net (Num)
| Newsgroups: microsoft.publi c.dotnet.genera l
| 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**********@go ogle.com
| NNTP-Posting-Date: Fri, 13 Feb 2004 15:05:02 +0000 (UTC)
| Path:
cpmsftngxa07.ph x.gbl!cpmsftngx a10.phx.gbl!TK2 MSFTNGXA05.phx. gbl!TK2MSFTNGP0 8
.phx.gbl!newsfe ed00.sul.t-online.de!t-online.de!newsf eed.icl.net!new sfeed.fj
serv.net!news.m axwell.syr.edu! postnews1.googl e.com!not-for-mail
| Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.genera l:124588
| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
|
| Hi all,
|
| I have to convert a J2EE date as a long ("Millis") in a .NET date as a
| long ("Ticks")
|
| In Java, currentTimeMill is, 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
6729
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 to long before being saved to the database. I now need to convert these long values back into datetime values.
3
5936
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 reminder. I need this reminder to remind the recipient 14 days in advance. I'm having problems with the ReminderMinutesBeforeStart. If I simply
2
9555
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 '(01C5288B to decimal) a.dwLowDateTime = -539522172 '(??????? by 84 8B D7 DF) MsgBox (GetFileToSystemDate(a, False))
2
589
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 and midnight, January 1, 1970 UTC. In .NET, DateTime.Ticks is the 100-nanosecond intervals that have
2
432
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 milliseconds, between the current time and midnight, January 1, 1970 UTC.
17
71364
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
7371
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 digit long value?
6
8209
by: chandanlinster | last post by:
what do the values of "clocks_ticks = sysconf(_SC_CLK_TCK);" and "CLOCK_PER_SEC" represent?
3
6601
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
1
7676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.