carlfaulkner Posted June 14, 2012 Share Posted June 14, 2012 this is part of my sql statement where i am completely stuck: SELECT *,month(timeStamp) AS month,day(timeStamp) AS day, year(timeStamp) AS year, DATE_FORMAT(timeStamp + INTERVAL 6 HOUR,'%H:%i') AS showtime FROM basically this works brilliantly but if lets say the time before i add 6 hours is between 18:00 - 23:59 i need to add 1 day to the day value. Any help would be great. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 14, 2012 Share Posted June 14, 2012 The calculations for the month, day, and year should use the same timestamp plus interval instead of only the timestamp. Link to comment Share on other sites More sharing options...
carlfaulkner Posted June 14, 2012 Author Share Posted June 14, 2012 so how would i code that. Wold it be just including the + interval 6 to day, month and year. Wold this for example if it were 2 hours before a new year add 6 hours on and change the year month and day... Link to comment Share on other sites More sharing options...
justsomeguy Posted June 14, 2012 Share Posted June 14, 2012 Right. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now