[eluser]qwang[/eluser]
there's an api which need gmt unixstamp, but our users are different timezones
so when i get unix timestamp with now(), i found it's different
below is my test code:
Code:
$this->load->helper('date');
date_default_timezone_set(tz_offset_to_name(timezones( 'UP8' )));
echo "TIMEZONE = ". date_default_timezone_get();
echo "<br />";
echo "CI now() = " . unix_to_human(now(), TRUE, 'eu');
echo "<br />";
echo "CI stamp = " . now();
echo "<br />";
date_default_timezone_set(tz_offset_to_name(timezones( 'UTC' )));
echo "TIMEZONE = ". date_default_timezone_get();
echo "<br />";
echo "CI now() = " . unix_to_human(now(), TRUE, 'eu');
echo "<br />";
echo "GMT time = " . gmdate('Y-m-d H:i:s', time());
echo "<br />";
echo "CI stamp = " . now();
anyone meet this problem
thank you