• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problem using Calendar class

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic