The Artima Developer Community
Sponsored Link

Java Answers Forum
System.currentTimeMillis UTC time problems

7 replies on 1 page. Most recent reply: Apr 20, 2006 1:55 AM by Dave Hinton

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 7 replies on 1 page
itay hindy

Posts: 6
Nickname: itayhindy
Registered: Apr, 2006

System.currentTimeMillis UTC time problems Posted: Apr 18, 2006 12:23 AM
Reply to this message Reply
Advertisement
Hi All,
I have the next problem.

I am in GMT +2:00 and in DST(+1:00). The difference between my clock and UTC time is 3 hours (because of day light). But when I use System.currentTimeMillis I get my time minus only 2 hours. For example:
My time - 15:00
GMT 0 time - 13:00
UTC time - 12:00

I expect to get for System.currentTimeMillis the value 12:00 while I get 13:00.

Can someone help me pls on that Issue. I must get the time in UTC.

Thx


Dave Hinton

Posts: 42
Nickname: catbells
Registered: Oct, 2003

Re: System.currentTimeMillis UTC time problems Posted: Apr 18, 2006 1:01 AM
Reply to this message Reply
GMT and UTC are almost the same thing — there is no hour gap between them.

You have checked that the time zone is correctly set on your computer?

itay hindy

Posts: 6
Nickname: itayhindy
Registered: Apr, 2006

Re: System.currentTimeMillis UTC time problems Posted: Apr 18, 2006 1:14 AM
Reply to this message Reply
UTC and GMT are ALMOST the same.
The difference is that UTC does not check day light settings and GMT check them.

For example :
UTC time now is 08:20 while GMT is 09:20.
Using System.currentTimeMillis I get 09:20.

UTC time can be found in http://www.worldtimeserver.com/current_time_in_UTC.aspx

Thx

Dave Hinton

Posts: 42
Nickname: catbells
Registered: Oct, 2003

Re: System.currentTimeMillis UTC time problems Posted: Apr 18, 2006 2:32 PM
Reply to this message Reply
No, GMT does not have daylight saving settings.

See http://wwp.greenwichmeantime.com/

itay hindy

Posts: 6
Nickname: itayhindy
Registered: Apr, 2006

Re: System.currentTimeMillis UTC time problems Posted: Apr 19, 2006 11:16 PM
Reply to this message Reply
Hi,

So when I Check GMT time I get 06:15 and when I use System.currentTimeMillis I get 07:15 no matter my windows time settings. Can I change it somehow so System.currentTimeMillis will return 06:15?

Dave Hinton

Posts: 42
Nickname: catbells
Registered: Oct, 2003

Re: System.currentTimeMillis UTC time problems Posted: Apr 20, 2006 12:57 AM
Reply to this message Reply
So when I Check GMT time I get 06:15

How are you checking this?

itay hindy

Posts: 6
Nickname: itayhindy
Registered: Apr, 2006

Re: System.currentTimeMillis UTC time problems Posted: Apr 20, 2006 1:04 AM
Reply to this message Reply
Using those 2 sites:
http://www.worldtimeserver.com/current_time_in_UTC.aspx
http://wwp.greenwichmeantime.com/

From those 2 sites I get the correct time which is the same time that all the clients send me (I work on the server side).

But System.currentTimeMillis give me that time + 1 hour no matter the windows xp settings.

Dave Hinton

Posts: 42
Nickname: catbells
Registered: Oct, 2003

Re: System.currentTimeMillis UTC time problems Posted: Apr 20, 2006 1:55 AM
Reply to this message Reply
I suspect your PC is set to the wrong time and to the wrong time zone.

You say that your time zone is normally GMT+0200 but currently GMT+0300 because of daylight savings. This means you need to select the correct GMT+0200 time zone, and ensure that the "Automatically adjust clock for daylight saving changes" checkbox is ticked.

Flat View: This topic has 7 replies on 1 page
Topic: Shopping Cart in Struts Previous Topic   Next Topic Topic: Errors while making a purchase order in Adventure Builder 1.0.4

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use