mhd_arif123 Posted February 11, 2012 Share Posted February 11, 2012 I think it is unusual but i dont know to fix it. when my computer clock shows 16: 13 hours , date() reuturns 10:43:16 . My systems time zone is +5.30 GMT. how does date() subtracts 5.30 hrs from the system time? Quote Link to comment https://forums.phpfreaks.com/topic/256888-date-function-returns-wrong-time/ Share on other sites More sharing options...
litebearer Posted February 11, 2012 Share Posted February 11, 2012 You can use date_default_timezone_set to switch between timezones. Pass the timezone information. If you are using PHP 5>=5.2, please use the more advanced DateTime class. example <?php echo date('h:i:s')."\n"; date_default_timezone_set('Europe/Paris'); echo date('h:i:s')."\n"; date_Default_timezone_set('UTC'); echo date('h:i:s')."\n"; Quote Link to comment https://forums.phpfreaks.com/topic/256888-date-function-returns-wrong-time/#findComment-1316963 Share on other sites More sharing options...
mhd_arif123 Posted February 11, 2012 Author Share Posted February 11, 2012 Thank you very much...... litebearer . It got solved.(Please tell me how to mark this thread as solved.) Quote Link to comment https://forums.phpfreaks.com/topic/256888-date-function-returns-wrong-time/#findComment-1316972 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.