Dates, yuck. Every time I get into dealing with a lot of dates from different datasources, it becomes a huge hairball.
Here's one trick that can make it a little easier.
You can force the default timezone used for an app server to be different then the timezone of the server it's running on, so at least that will remain consistant if your various servers are not all set the same. And it's quite simple.
First, create a simple ServletContextListener like so...
Second, initiate the context listener from your web.xml file...
That's it, your app will now run with the default timezone you set no matter what server it's running on, or what the timezone is on that server.
Unfortunately the log files it produces will still be in the servers timezone, which is annoying. Anyone got an easy fix for that?
No comments:
Post a Comment