Destramic Posted October 26, 2014 Share Posted October 26, 2014 hey guys im wondering how you would add or takeaway a hour from a timestamp in a database when trying to select it please? thank you Quote Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/ Share on other sites More sharing options...
Zane Posted October 27, 2014 Share Posted October 27, 2014 SELECT DATE_SUB(OrderDate,INTERVAL 1 HOUR) AS SubtractDate FROM Orders Quote Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/#findComment-1494865 Share on other sites More sharing options...
Destramic Posted October 27, 2014 Author Share Posted October 27, 2014 ok great thanks...would that work the same if users timezone is -1? due to getting the user timezone via javascript it will return results as +1, -1 or 0 etc... although i could return the results as 00:00, -01:00, +01:00 etc.... thank you again Quote Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/#findComment-1494872 Share on other sites More sharing options...
Solution Destramic Posted October 27, 2014 Author Solution Share Posted October 27, 2014 this did the trick CONVERT_TZ(now(), '+00:00', '+05:00') Quote Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/#findComment-1494904 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.