aspose file tools*
The moose likes Java in General and the fly likes Problem using Calendar class 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 "Problem using Calendar class" Watch "Problem using Calendar class" New topic
Author

Problem using Calendar class

Kanchan Singh
Ranch Hand

Joined: Dec 27, 2007
Posts: 38
Hi All

I am using the following piece of code in my application


when I execute in my local system it is giving me proper date but when this code is executing in a different production server then the date value is not constant it keeps on changing on the same day. I am a bit confused what could be the reason.

Any suggestion for this kind of behaviour.


Thanks
Kanchan
Sunny X Narula
Greenhorn

Joined: Dec 07, 2008
Posts: 22
If by different you mean correct date but in a different format (other than MM/dd/yyyy),
try skipping locale.
There is no need for the locale, by default I guess, the language must be English or as set on the server.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Kanchan Singh wrote:

when I execute in my local system it is giving me proper date but when this code is executing in a different production server then the date value is not constant it keeps on changing on the same day

Also, if the date difference is not big, say today is 17 and date changes to 18 or 16 , then it may be the problem with locale, otherwise you have to explain it little more. like what is the default locale of your production server ?, is the date correct there ? where you're executing this code ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Radhakrishnan Ranjit
Greenhorn

Joined: Aug 12, 2009
Posts: 10
Also, I am sure you will be aware - but just in case missed: make sure that the time difference is not due to the clock time differences (if the production server is located at another country/region). I mean the local time.
Kanchan Singh
Ranch Hand

Joined: Dec 27, 2007
Posts: 38
Hi All

Thanks for your reply.

The server time is proper and it changes at US mid night.

Today also I checked but it is still the same that is 08/17/2009.

Regards
Kanchan
Radhakrishnan Ranjit
Greenhorn

Joined: Aug 12, 2009
Posts: 10
Please make sure that the timezones are correct which you are referring to. Also check it after say a couple of hours cause currently certain locations in US are still with 17 August 2009.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Also, to have a proof, see what's present JR time is, at the time of posting, the JR servers (which is located in Atlanta, if I'm correct, because of the recent server shift) time is this:

All times above are in your local time zone & format.The current ranch time (not your local time) is Aug 18, 2009 00:37:28.

It means, just before 37 minute, the date is 17 August 2009, while in India, we had 18 August afternoon, at the same time
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using Calendar class