I have been trying to get php to subtract 1 week from Easter and the outputs are just downright bizarre.
This is what I currently have
<?php $year = date("Y"); $easterdate = date('d-m-y',easter_date($year)); $newdate = strtotime('-7 days', strtotime($easterdate)); ?> <body> <?php echo $newdate;?> <br> <?php echo $easterdate;?> <br> </body>
The output I get is
newdate = 14-04-04
easterdate = 04-04-21
For some reason (which maybe very obvious that I can’t see) is that when I try to calculate the minus 7 days, it subtracts the years and reformats it to Y-M-D.
I have reviewed the other forum questions about subtracting time and have tried various methods including the php.net site.
Source: Ask PHP