php - time() results a different time -


i think has php timezones. current date , time 10:51 pm , , 7/15/2013 . (i on windows , bottom right showing :) )

i use following php code

<?php echo date("d/m/y : h:i:s", time()); ?> 

and browser displayed: 15/07/13 : 19:06:15 (about 3 hours , 45 minutes early).

first question: why happen?

second question: if because php's default timezone else (mine gmt 5:45), how can edit php's conf (or whatever) time() returns time timezone?

you can either set time zone in php.ini file or can in code:

<?php date_default_timezone_set('america/los_angeles'); ?> 

http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone http://php.net/manual/en/function.date-default-timezone-set.php http://www.php.net/manual/en/timezones.php

also date_default_timezone_get() show timezone have set.


Comments