Hurda
Hurda

Reputation: 4715

Appengine permissions to change Joda time default time zone

I want to change default time zone so it's our local European/Prague - because I work with week/days boundaries.

But calling (I call it in filter bfore processing each request)

DateTimeZone.setDefault(DateTimeZone.forID(DateUtils.TIME_ZONE));

results into permissions excpetion. I don't think I cant accquire new permissions on appengien, what do I do?

TimeZone.setDefault(TimeZone.getTimeZone(DateUtils.TIME_ZONE)); works fine though

Upvotes: 1

Views: 264

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1501043

Personally I would simply avoid using the default time zone anywhere. Always pass the time zone in explicitly to whatever will be using it. That makes the code clearer, more robust in the face of system defaults changing, more robust in the face of requiring two time zones to be used in the same application, and means you don't need to work out how to change the system default on AppEngine.

(As an aside, in my port of Joda Time to .NET, although we support fetching the system time zone, we don't use it as the default anywhere in the code - you have to be explicit about what you want. The system default is the wrong choice in so many situations, it's a bad idea to use it by default IMO.)

Upvotes: 2

Related Questions