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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.