forumnz Posted May 19, 2009 Share Posted May 19, 2009 I have a timestamp in a database the problem is that it's 10 hours behind the right time. This is the format "2009-05-17 15:59:53". How can I add 10 hours to this? Thanks Sam Quote Link to comment https://forums.phpfreaks.com/topic/158823-changing-time-using-timestamp/ Share on other sites More sharing options...
Maq Posted May 19, 2009 Share Posted May 19, 2009 Look at ADDTIME(). This also seems like a MySQL issue, since I assume you want to UPDATE all of the records by adding 10 hours. Quote Link to comment https://forums.phpfreaks.com/topic/158823-changing-time-using-timestamp/#findComment-837663 Share on other sites More sharing options...
Brian W Posted May 19, 2009 Share Posted May 19, 2009 you could set your time zone in the ini or on the fly per page (before anything else) by using date_default_timezone_set('America/Phoenix'); and replace Phoenix with your supported local city found here. Else, you can use the unixtimestamp returned by strtotime("-10 hours") (Sorry, reply is for changing timezone in php, please excuse me... I ended up in the wrong board) Quote Link to comment https://forums.phpfreaks.com/topic/158823-changing-time-using-timestamp/#findComment-837665 Share on other sites More sharing options...
fenway Posted May 20, 2009 Share Posted May 20, 2009 Just remeber that timezone "magic" only works on timestamp fields. Quote Link to comment https://forums.phpfreaks.com/topic/158823-changing-time-using-timestamp/#findComment-838191 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.