Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using Calendar class

 
Kanchan Singh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Radhakrishnan Ranjit
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic