@ 2014-05-27T09:34:11Z <?php
$now = new DateTime('now');
$date = new DateTime('2014-05-01');
// Total difference in days
$total_days = date_diff($now, $date)->format('%a');
// Get weeks
$weeks = floor($total_days / 7);
// Get days
$days = $total_days % 7;
echo $weeks . ' weeks and ' . $days . ' days ago';
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.6.28 , 7.0.14 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 3 weeks and 5 days ago Output for 7.0.6 107 weeks and 2 days ago Output for 7.0.5 100 weeks and 3 days ago Output for 7.0.4 97 weeks and 0 days ago Output for 7.0.3 98 weeks and 2 days ago Output for 7.0.2 98 weeks and 6 days ago Output for 7.0.1 99 weeks and 0 days ago Output for 7.0.0 99 weeks and 3 days ago Output for 5.6.21 104 weeks and 4 days ago Output for 5.6.20 101 weeks and 3 days ago Output for 5.6.19 96 weeks and 5 days ago Output for 5.6.18 97 weeks and 5 days ago Output for 5.6.17 98 weeks and 3 days ago Output for 5.6.16 99 weeks and 4 days ago Output for 5.6.15 99 weeks and 5 days ago Output for 5.6.14 102 weeks and 0 days ago Output for 5.6.13 102 weeks and 1 days ago Output for 5.6.12 102 weeks and 6 days ago Output for 5.6.11 103 weeks and 3 days ago Output for 5.6.10 103 weeks and 4 days ago Output for 5.6.9 103 weeks and 6 days ago Output for 5.6.8 104 weeks and 2 days ago Output for 5.5.35 107 weeks and 4 days ago Output for 5.5.34 101 weeks and 4 days ago Output for 5.5.33 96 weeks and 6 days ago Output for 5.5.32 98 weeks and 0 days ago Output for 5.5.31 98 weeks and 4 days ago Output for 5.5.30 100 weeks and 1 days ago Output for 5.5.29 102 weeks and 3 days ago Output for 5.5.28 103 weeks and 0 days ago Output for 5.5.27 103 weeks and 1 days ago Output for 5.5.26 103 weeks and 5 days ago Output for 5.5.25 104 weeks and 1 days ago Output for 5.5.24 107 weeks and 5 days ago Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 91 weeks and 0 days ago Output for 5.2.0 - 5.2.17 Fatal error: Call to undefined function date_diff() in /in/PcXY0 on line 7
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 Fatal error: Class 'DateTime' not found in /in/PcXY0 on line 3
Process exited with code 255 . Output for 4.4.2 - 4.4.9 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/PcXY0 on line 7
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/PcXY0 on line 7
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/PcXY0 on line 7
Process exited with code 255 . preferences:dark mode live preview
241.41 ms | 401 KiB | 344 Q