Proposals/timezones
From Mahara Wiki
< Proposals
Timezone support for Mahara
THIS IS A DRAFT
Option 1: Convert
The following tables need fields and data converted
activity_queue artefact artefact_cron artefact_internal_profile_email artefact_log artefact_plans_task artefact_resume_certification artefact_resume_educationhistory artefact_resume_employmenthistory artefact_resume_membership artefact_resume_personal_information auth_cron blocktype_externalfeed_data blocktype_wall_post collection cron export_cron favorite "group" group_member group_member_invite group_member_request import_cron import_queue institution interaction_cron interaction_forum_edit interaction_forum_post interaction_instance notification_cron notification_emaildigest_queue notification_internal_activity search_cron site_content site_data usr usr_friend usr_friend_request usr_infectedupload usr_institution usr_institution_request usr_password_request usr_registration usr_session usr_watchlist_view view view_access view_visit
Conversion process
Schema
The datetime fields in the database ought to be converted to integer so as to take the unix timestamp.
Stored data
The data contained in these fields then needs to be converted from the machine time to unix time
Code changes
Check all the places in the code where the date is displayed in human readable format.
Resources
http://stackoverflow.com/questions/2689428/mysql-convert-db-from-local-time-to-utc http://stackoverflow.com/questions/2700197/sql-server-convert-date-field-to-utc
Option 2: User offset
Uglier but less traumatic.
Schema
New table: timezones eg:
timezone (varchar) | offset (int) -------------------+------------- Pacific/Auckland | 0 UTC | 43200
In usr table, new field: timezone
Usage
When displaying dates to users, use the stored data, convert to epoch, add offset, convert to human readable.