Dates, Times, and Time Zones

From WeBWorK_wiki
Jump to navigation Jump to search

General Information

WeBWorK uses the Olson database ( for time zone information. To see a list of valid time zones connect to

These time zones are more refined than standard time zone usage in that they include switches to daylight savings time (e.g. some parts of a time zone may make the switch and others may not). For example if you are in the eastern US, on the list you will see DateTime::TimeZone::America::New_York and you should use America/New_York when entering time zone information into WeBWorK.

A default time zone for the WeBWorK system is set in the file /opt/webwork/webwork2/conf/global.conf In that file, e.g. replace $siteDefaults{timezone} = ""; by $siteDefaults{timezone} = "America/New_York";

To set a different time zone for a particular course, go to Course Configuration and enter your desired time zone under the General tag.

There is a subtle difference in how date/times are entered into WeBWorK and how they are displayed but almost no one will notice this difference. In the Hmwk Sets Editor you will see date/times displayed as 11/14/2009 at 07:45am EST. You can always enter dates/times in the format 11/14/2009 at 07:45am without the time zone information and WeBWorK will use the time zone the course uses. You can usually enter dates/times in the format WeBWorK uses to display them, e.g. 11/14/2009 at 07:45am EST with the time zone information. However, for a few places in the world, this will cause an error. If you are interested in what is really going on, continue reading.

Detailed Information

At least now I understand the problem. We are using standard Perl modules to convert back and forth from a human readable format into epoch time (which is in seconds from 1/1/1980 I think).

The main module is

This uses things like "Asia/Jerusalem" but also has short names such as IDT. Here's what is said about these short names:

   $tz->short_name_for_datetime( $dt )
   Given a DateTime object, this method returns the "short name" for the current observance and rule this datetime is in. These are names like "EST", "GMT", etc.
   It is strongly recommended that you do not rely on these names for anything other than display. These names are not official, and many of them are simply the invention of the Olson database maintainers. Moreover, these names are not unique. For example, there is an "EST" at both -0500 and +1000/+1100.

So these names are for display only. If instead of "IDT" you used "Asia/Jerusalem" there would be no error. But since the display uses e.g. EST, if someone entered EST the first part of the routine fails since EST (and IDT) are not valid. But since everyone probably does this (instead of using America/New_York) they just copy what the display looks like), we call a second module which knows quite a few short names - click on the above link and view the source to see them --- (but certainly not all). E.g. it does not know IDT or IST this is the reason for your error.

The best thing to do (as you have discovered) is to enter times without using IST or IDT and then dates/times will be in whatever timezone the course uses. I guess we could drop the time zone short name from the display but for most of the world, there is no problem. And if there is a problem, there is an easy solution so I think we will just leave things as they are.

If you want you can ask the authors of to update it adding ISD and IDT.