Re: [Simpleweb-Support] DateParser not adjusting for time zone differences?
Brought to you by:
niallg
From: Niall G. <ni...@em...> - 2004-06-23 11:05:15
|
Hi, > It would appear that DateParser doesn't take the local time zone into account when generating its string representation: I have had a look at the DateParser and it seems that getting a Calendar for a Locale such as Locale.UK or Locale.US does not affect the time generated by the Calendar. Since I am in GMT I did not verify this. I have changed DateParser such that it uses a TimeZone like this public DateParser(long date) { TimeZone zone = TimeZone.getTimeZone("GMT") Calendar calendar = Calendar.getInstance(zone); calendar.setTime(new Date(date)); // etc ... } Instead of public DateParser(long date) { Calendar calendar = Calendar.getInstance(Locale.UK); calendar.setTime(new Date(date)); // etc ... } Also, the DateParser.toLong method needs to be modified to replace Locale.UK with the correct time zone object. It sould work with these modifications, which I will include when I make the next release... Thanks for the feedback, Niall -- _______________________________________________ Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free! http://www.net2phone.com/cgi-bin/link.cgi?143 |