Welcome Guest, Not a member yet? Register   Sign In
Manage date as UTC
#2

(01-02-2016, 11:40 AM)Gianluigi Wrote: Hi there,

I'm setting up a website that provide access/translation for different regions.

The system should show users the same date/time, example:
User 1 is from USA, Washington (GMT-5) -> 2th Jan, 13:30
User 2 is form Australia, Canberra (GMT+11) -> 3th Jan, 05:30

I want to show GMT+0 (18:30) -> 2th Jan, 13:30 for all users.

And I want avoid DLS changes. I've read that there are 2 GMT types:
- GMT as UTC (no DLS changes) - I want this
- GMT as region (DLS changes)


Now, in CodeIgniter, what I should do to collect that? I see in config.php an option ($config['time_reference'] = 'local'Wink.
I should change it or not? And that change give me chances to show the same date/time to all users?

I know, I'm newbie here, but if you have simple practice example on how-to-do it as best practice, would be perfect.

Thank you all!

The only instance where time_reference is used is in the now() function of the date helper. The now() function is really just an adjusted time() function, so not likely to handle all of your needs. For instance, if you are using CURRENT_TIMESTAMP as the default or update value in a MySQL table, that time will be the server's local time unless you have specified the timezone to MySQL. I believe this is also true for the MySQL NOW() function. If you need MySQL to always have a set timezone, then you will want to run the following before doing any queries that have time related inserts or updates:


PHP Code:
$this->db->query('SET time_zone = "00:00"'); 
Reply


Messages In This Thread
Manage date as UTC - by Gianluigi - 01-02-2016, 11:40 AM
RE: Manage date as UTC - by skunkbad - 01-02-2016, 12:19 PM
RE: Manage date as UTC - by Gianluigi - 01-02-2016, 04:22 PM
RE: Manage date as UTC - by skunkbad - 01-02-2016, 05:19 PM
RE: Manage date as UTC - by Gianluigi - 01-03-2016, 04:19 AM
RE: Manage date as UTC - by skunkbad - 01-03-2016, 10:08 AM
RE: Manage date as UTC - by Gianluigi - 01-03-2016, 12:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB