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 Question about Calendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question about Calendar" Watch "Question about Calendar" New topic
Author

Question about Calendar

Gökhan Sakalli
Greenhorn

Joined: Apr 04, 2009
Posts: 20
Hello. I am trying to send a Calendar object as a parameter

For example i am trying to send

10th of Januarry 2010 11:47

and it sends 2011-01-10T09:47:49.000Z(This date was converted from java.sql.Date object to Calendar object)

When i try to send 10th of Januarry 2010(no hour or second, was converted from java.util.Date to Calendar object)

it sends 2011-01-09T22:00:00.000Z

Does not 2011-01-09T22:00:00.000Z mean 10th of Januarry 2010?

Thank you. BTW I'm in Turkey.
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

How are you performing the conversion?


Java Experience
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

The "Z" at the end of those strings mean that they indicate a date and time in the UTC timezone. You are 2 hours ahead of the UTC timezone. When it's 9:47 in UTC, then it's 11:47 in your local timezone.

And 09-01-2011, 22:00 UTC is 10-01-2011, 00:00 in your local timezone.

If you still have a problem, then can you explain with some source code what exactly you are doing, why it doesn't do what you want, and what exactly you want to achieve?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Gökhan Sakalli
Greenhorn

Joined: Apr 04, 2009
Posts: 20
That exactly is what the answer to my question is.

Thank you very much. I was looking for what T and Z means.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

The "T" is just a separator character to separate the date from the time.

Note that this is the standard ISO 8601 format for dates and times, which is used as a standard format in for example XML files.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about Calendar