smy101 Posted March 16, 2007 Share Posted March 16, 2007 SO I have a script with the following line of code: date("F j, Y, g:i a"); Which returns the time like: "March 16, 2007, 12:25 pm" The problem is that is in Eastern time (presumably where my server is) and I need it to return in Central time. Can someone tell me what I need to modify to get that to return Central time? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/43006-make-script-return-time-in-central-time/ Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 $offset = 2; // + 2 hours $offset = -2; // -2 hours date("F j, Y, g:i a", time()+60*$offset); Link to comment https://forums.phpfreaks.com/topic/43006-make-script-return-time-in-central-time/#findComment-208870 Share on other sites More sharing options...
smy101 Posted March 17, 2007 Author Share Posted March 17, 2007 $offset = 2; // + 2 hours $offset = -2; // -2 hours date("F j, Y, g:i a", time()+60*$offset); Thanks! That didn't work as written, but I modified it slightly and it works perfect now. The "$offset" time was subtracting minutes rather than hours so I had to modify it as follows: $offset = -60; // -60 minutes; date("F j, Y, g:i a", time()+60*$offset); That subtracted exactly 1 hour off the time so its all good now. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/43006-make-script-return-time-in-central-time/#findComment-209280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.