Answer the question
In order to leave comments, you need to log in
How to get the number of weeks in a year and for 5 years?
how to display the number of weeks that have passed since my birth for example from this date 2000-09-05
Answer the question
In order to leave comments, you need to log in
<?php
$datetime1 = new DateTime('2000-09-05');
$datetime2 = new DateTime('2020-04-13');
$interval = $datetime1->diff($datetime2);
$diff_days = $interval->format('%a');
$diff_weeks = floor($diff_days/7);
echo "days: {$diff_days}\n";
echo "weeks: {$diff_weeks}\n";
//days: 7160
//weeks: 1022
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question