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 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 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 Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/#findComment-1494872 Share on other sites More sharing options...
Destramic Posted October 27, 2014 Author Share Posted October 27, 2014 this did the trick CONVERT_TZ(now(), '+00:00', '+05:00') Link to comment https://forums.phpfreaks.com/topic/292083-timestamp-extracting-time/#findComment-1494904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.