Dale_G Posted March 24, 2008 Share Posted March 24, 2008 Hello everyone, This is a snippet of my script right now... $time = "\n\nTime: ".date('h:i:s A'); fwrite($handle, $time); This code is apart of a script in which it gathers information and logs it to a .txt file. Now, what I'd like to do is offset the time it's outputting ahead by 3 hours. So if it's logging Time: 8:44:21 PM I'd like it to be offset by 3 hours, to match my local time. So it would now be... Time: 11:44:21 PM Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/97641-solved-offsetting-server-time-ahead-to-local-time-using-date/ Share on other sites More sharing options...
wildteen88 Posted March 24, 2008 Share Posted March 24, 2008 Use the set_default_time_zone function or use date('h:i:s A', strtotime('+3 hours')); Quote Link to comment https://forums.phpfreaks.com/topic/97641-solved-offsetting-server-time-ahead-to-local-time-using-date/#findComment-499586 Share on other sites More sharing options...
Dale_G Posted March 24, 2008 Author Share Posted March 24, 2008 Thank you very much, works. Quote Link to comment https://forums.phpfreaks.com/topic/97641-solved-offsetting-server-time-ahead-to-local-time-using-date/#findComment-499589 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.