Welcome Guest, Not a member yet? Register   Sign In
date/time timezones -suggestion
#1

[eluser]UnknownPlayer[/eluser]
Hi,
i have events website in CI, registred user can add new events, now i have question and suggestion.

In config i have set:
Code:
$config['time_reference'] = 'gmt';
date_default_timezone_set('UTC'); // don't know if this can help at all
When user go on page that show event, he gets time and date in his timezone:
Code:
$date = gmt_to_local($event->date, $this->session->userdata('timezone'), FALSE);
That will show time in his timezone, but now i have problem, when user want to add a new event.

If his timezone is "UP3" and he add a event, how should i save timestamp in db, now.
Example..
If user set "12/25/2012 13:00", how can i convert that from his timezone to gmt ? I think that local_to_gmt doesn't do that becouse there is no timezone attribute in that function.

I am trying to save all dates in gmt, so that will be default in db, and for each user to read at his timezone, is this bad way of solving this problem ?
And what is your suggestion for this problem ?


Messages In This Thread
date/time timezones -suggestion - by El Forum - 12-11-2012, 03:26 PM
date/time timezones -suggestion - by El Forum - 12-11-2012, 06:49 PM
date/time timezones -suggestion - by El Forum - 12-12-2012, 08:05 AM
date/time timezones -suggestion - by El Forum - 12-13-2012, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB