mardi 5 juillet 2016

MariaDB start of week date & week number 1 to 52

I've written a stored procedure to get the week from a date, it also returns the date at the start of the week as well as the week number and year.

I'm aware of the 'WEEK' function, however this doesn't give me the date at the start of the week and I'm not aware of a function that does this given the week and year.

Question is:
How can I get the 'date' at the start of the week given the week number? Where the start of the week is passed in as a day index, 0 = Sunday, 1 = Monday etc.

My current function doesn't always work and if the first day of the week is Monday, then Sunday falls into the next week, not the end of the same week as I would like it to be.

Aucun commentaire:

Enregistrer un commentaire