Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Timezone information

From MoodleDocs
Revision as of 05:08, 4 February 2015 by Jetha Chan (talk | contribs) (Created page with "Timezone information in Moodle is manually kept up-to-date with the IANA's Olson database as new information is released. This page contains information on this process. == G...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Timezone information in Moodle is manually kept up-to-date with the IANA's Olson database as new information is released. This page contains information on this process.

Getting new information from the IANA

There are two ways you can get information from the IANA - by downloading the latest release and manually concatenating specific files together, or by running a Python script built for that purpose.

Manual retrieval

  • Go to the IANA's Time Zone Database site and get the latest data file (e.g. tzdata*****.tar.gz).
  • Extract the file to an appropriate location.
  • Create a new text file, naming it olson.txt and concatenate the following files in the following order:
    • africa
    • antarctica
    • asia
    • australasia
    • europe
    • northamerica
    • southamerica
    • etcetera

Automatic retrieval

Importing information into Moodle

  • Place the generated olson.txt file into {dataroot}/temp/olson.txt, where {dataroot} is the path to your Moodle's moodledata folder
  • In a browser, go to Site administration -> Location -> Update timezones and confirm
    • The contents of your timezone database table will be flushed and regenerated from the olson.txt

Exporting information

  • Using a DB admin tool (e.g. phpMyAdmin, pgadmin3), generate a CSV file from your timezone database table with the following settings:
    • commas as field separators
    • non-quoted values
    • unix line feeds
    • first line as field names
  • Replace {moodleroot}/lib/timezone.txt with the contents of the CSV file
  • Commit to git and fill out the tracker fields as necessary

The integrators have a separate process that copies the {moodleroot}/lib/timezone.txt out of HEAD to https://download.moodle.org/timezone/, so you shouldn't have to do anything more.