Skip to content
Advertisement

Display the first and last day of a (calendar) week

In my database I have a table with consecutive dates. I group all dates to calendar weeks and display them in a table in my CSS.

Now i want to display also the first and the last day of the calendar week in my table. Here is my code:

Currently there is only shown the first day of the calendar week. I thought of duplicating $row['Date']and adding +6 (days) but the first dataset is not the first day of the week. So the first date range of the first calendar week would be wrong. Does anyone has an idea how to solve this problem?

Advertisement

Answer

See a test of this here: https://www.tehplayground.com/c2dOYxxwIa9LDscW

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement