The Elearning Community • Time zones
Page 1 of 1

Time zones

Posted: Mon Apr 11, 2016 6:02 am
by drewlander
Any plans to take advantage of the underutilized time_offset in i18n/lib.regset.php ? A user profile setting for the end-user to see local times would be ideal.

Re: Time zones

Posted: Tue Apr 12, 2016 10:38 am
by alberto
Hi drewlander, welcome on board :)
This feature isn't in our roadmap at the moment, we will consider adding it for future releases

If you are planning to add it by yourself we'll be happy to integrate it, or if you need this feature to be implemented earlier send us a pvt for a quote

Re: Time zones

Posted: Tue Apr 12, 2016 5:44 pm
by drewlander
ill consider coding this one myself. I noticed the time_offset in lib.regset.php under i18n and tested it as working when using the value as minutes. I have not checked to see if that stores the times to the database with the offset or if it just changes the display value, and I have not checked the effects of the offset in all screens. If I were to implement such a feature, I would continue to store all times as UTC and use an offset for the display to the end user. Do you have any loose instruction before I set out to code this so I can make it useful for everyone?

Re: Time zones

Posted: Tue Apr 12, 2016 7:30 pm
by drewlander
Interesting thing about the time_offset is that it doesnt seem to exist "out-of-the-box" as a setting in core_reg_setting. I add it and it works as I expect, using the value in +/- minutes. It's like a hidden feature.

Anyway, I tested this and it does seem to store to the database with the offset. I think I can handle this but I'm open to any suggestions or concerns you might have.

Re: Time zones

Posted: Wed Apr 13, 2016 9:19 am
by canelli
Hi drewlander

Take in mind that in the database all times, for all users, must be registered in the same timezone, otherwise SInce you can experiment some unexpected results when see or manage data cross-user.

If you have all the users in the same timezone , you don't need tweek anything , just set up correclty the timezone on your server / installation : at server level, at php and mysql level or at forma.lms configuration

Remember also that the php and mysql must be set in the same timezone, because some time calculations are made by database and other by php.

there are the following two parameters you can set in config.php (and perhaps in core_setting table) to handle the time zone

Code: Select all

//$cfg['timezone'] = 'Europe/Rome';  //define if different from php.ini setting
//$cfg['set_mysql_tz'] = false;          //set mysql timezone same as php timezone , default false
The pourpose of i18n library is to handle some regional settings related to a user or language: display of time, date, digit separator, decimal separator and so on

Re: Time zones

Posted: Wed Apr 13, 2016 9:22 pm
by drewlander
Thanks for that information. Ill consider all these factors when I review over the weekend and reserve my immediate thoughts for some testing before I lay out a path.


This site uses cookies.

Some of the cookies we use are essential for parts of the site to operate and have already been set. We also use Google Analytics scripts, which all use cookies.
You may delete or block all cookies from this site in your browser options.