This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
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 ?
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.
Joined: Dec 27, 2007
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.
Joined: Aug 12, 2009
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.