smerny Posted December 23, 2009 Share Posted December 23, 2009 Hey, date('Y-m-d g:i a', time()) gives me 2009-12-22 8:19 pm when the GMT time is 2009-12-22 3:19 am how can i make time() use GMT time? Quote Link to comment https://forums.phpfreaks.com/topic/186106-gmttime/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 23, 2009 Share Posted December 23, 2009 The problem is not the time() function, the problem is the date() function. It takes into account the current time zone setting. See this link - http://us3.php.net/gmdate Quote Link to comment https://forums.phpfreaks.com/topic/186106-gmttime/#findComment-982831 Share on other sites More sharing options...
smerny Posted December 23, 2009 Author Share Posted December 23, 2009 hmm.. this is what i was trying to do $endtime = mktime(0,0,0,12,30,2009); $currenttime = time(); $timeleft = ($endtime - $currenttime); and then figure out the days/hours until the endtime based on the timeleft... it was giving me the wrong time so i tested the time() like in my first post... i'm still unsure how to use the gmdate the example says echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998)); what is the 1/1/1998 date all about? like how does it return "Dec 31 1997 22:00:00"? and do i need to do date formatting stuff to figure out the difference? edit: maybe it wasn't the date, it was the mktime that was off? and should be gmmktime? i did this and it seems to be working... still have the questions above i'm confused about Quote Link to comment https://forums.phpfreaks.com/topic/186106-gmttime/#findComment-982832 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.