php - Strftime Displaying Incorrect Time -
what i'm trying correct time of user browsing website , add 10 minutes current time. here hte code have:
<?php $now = time(); $closetime = $now+600; echo strftime("%a %b %e %i:%m%p %z",$closetime) . "\n"; ?> everything works intended, issue timezone off. i'm on eastcoast 12:55 here, above code output: monday oct 7 12:05pm cdt 1 hour behind want.
how make appear correctly user no matter country or timezone display 10 minutes current time?
check timezone using ini_get('date.timezone'). if isn't right timezone search date.timezone in php.ini file , edit value 1 of supported timezones values php have.
date.timezone = "america/los_angeles"
if don't have access php.ini file can overwrite value date_default_timezone_set function @ begining of app evertytime executed.
Comments
Post a Comment