This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Time Zone Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Time Zone Query" Watch "Time Zone Query" New topic
Author

Time Zone Query

Pratik Parekh
Greenhorn

Joined: Jun 09, 2011
Posts: 19

What is the meaning of this code

Long timeStampSecs=System.currentTimeMillis();
long millis=timeStampSecs*1000L-TimeZone.getTimeZone(DateConstants.TZ_IST).getRawOffset();

Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

If you multiply the milliseconds returned by System.currentTimeMillis() by 1000, you would get the current time in microseconds.
Subtracting milliseconds returned by the getRawOffset() method from the current time in microseconds, I'm pretty sure that the result is irrelevant.

I believe that whoever wrote this was trying to get UTC time in millis, even so, the use of a Calendar would have been more appropiate.

Claudiu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Time Zone Query