im pondering on some functions on MySQL especially on dates and times and i stumbled upon an idea where i can't find a predefined function that gets the next day of a specific day. For example: As of this post, the Date and Time is (GMT +8) : July 4, 2001 5:28PM - Monday. I want to find the next date when Monday will occur again. The answer should be: July 11, 2011. Anyone who could help me with this one?

Recommended Answers

Try using DATE ADD()----add 7 days

and then use %W for mat to extract the day o use DAYNAME(date)

SELECT OrderId,DATE_ADD(OrderDate,INTERVAL 45 DAY) AS OrderPayDate
FROM Orders
Jump to Post

All 2 Replies

Try using DATE ADD()----add 7 days

and then use %W for mat to extract the day o use DAYNAME(date)

SELECT OrderId,DATE_ADD(OrderDate,INTERVAL 45 DAY) AS OrderPayDate
FROM Orders

thanks very much debasisdas...it really help me a lot :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.