Welcome Guest, Not a member yet? Register   Sign In
now() is not always gmdate
#1

[eluser]qwang[/eluser]
i use date hlper's now() function to generate a gmt date
but i found under different environment
the time is not always gmt date

my test evn is using xampp under windows, and now() returns gmt date
but under my server which is linux, now() returns server time

so anyone meets this problem, and how did you do to solve this
thank you
#2

[eluser]Clooner[/eluser]
[quote author="qwang" date="1282069329"]i use date hlper's now() function to generate a gmt date
but i found under different environment
the time is not always gmt date

my test evn is using xampp under windows, and now() returns gmt date
but under my server which is linux, now() returns server time

so anyone meets this problem, and how did you do to solve this
thank you[/quote]afaik now() won't return gmt by default. You will have to enable it in the config file and it has to be correctly configured in the server
#3

[eluser]qwang[/eluser]
thanks Jeroen
i checked again the config.php and found that as your post said, i missed to change the server's config.php
so now() returns gmt date
i have another question as belows
echo "GMT Time:" . gmdate('Y-m-d H:iConfused', time());
echo "<br />";
$now = time();
$system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
echo "GMT Time 2:" . gmdate('Y-m-d H:iConfused', $system_time);
echo "<br />";

i found that the two GMT time returned by gmdate() is different, and don't know why
ci use the second method, can you give me some explanation, thank you




Theme © iAndrew 2016 - Forum software by © MyBB