I need to generate a date of Monday of a week from a date (example: 2015/10/22). And generate the dates for the next days: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
Example in Java: (initial date = 2015/10/22)
// Monday:
date.set (Calendar.DAY_OF_WEEK, Calendar.MONDAY);
// Add the next day (Tuesday)
date.add (Calendar.DATE, 1);
// Add the next day (Wednesday):
date.add (Calendar.DATE, 1);
How can I do this in Python?
Its easier in python using timedelta function
The trick is the use of weekday() function. From documentation
So subtracting it from current date gives the date of Monday of that week