File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Calendar.getTime() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Calendar.getTime()" Watch "Calendar.getTime()" New topic
Author

Calendar.getTime()

Himalay Majumdar
Ranch Hand

Joined: Sep 28, 2008
Posts: 324
Please see the code below..


In a particular iteration @line 12

I watch ..
memoType.getMemoDate() evaluatesTo 2009-12-23Z
but memoType.getMemoDate().getTime() evaluatesTo Tue Dec 22 19:00:00 EST 2009 (going to the previous date)

Any idea why is this happening, any workaround.

Thank you
-Himalay


SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Bupjae Lee
Ranch Hand

Joined: May 14, 2007
Posts: 107
"2009-12-23Z" actually means "Wed Dec 23 00:00:00 GMT 2009"

GMT stands for "Greenwich Mean Time", the worldwide standard time
EST stands for "Eastern Standard Time", (probably) your local time.
EST is 5 hours behind GMT (without daylight saving time)

The conclusion is that "2009-12-23Z" and "Tue Dec 22 19:00:00 EST 2009" represents same moment

It seems that the time zone of your java.util.Calendar instance is not set properly.
Himalay Majumdar
Ranch Hand

Joined: Sep 28, 2008
Posts: 324
Thanks for taking your time on this Bupjae, I figured this out on the same day after decoding the mystery behind the Z..
All I need to know now is if the setting of the time is done before we consume the web service. Thanks again.


 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Calendar.getTime()
 
Similar Threads
How to Compare two Calendar Objects.
jdom and jaxen question
No Persistent Classes found for Query Class
Time format in Java
values change unexpectedly due to threading issue?