How To Calculate the Next Anniversary Date in PHP
erics, Posted September 12th, 2012 at 3:11:45pm
1 2 3 4 5 6 7 8 9 10 11 |
$now = time(); $this_year = strtotime('1 July'); $delta = $this_year - $now; if ($delta > 0) { // this year's anniversary date is still to come, use it $anniversary = $this_year; } else { // nope, use next year's date $anniversary = strtotime('1 July +1 year'); } |
Leave Your Comment
All fields marked with "*" are required.