Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Assuming the date you're looking for is January 2:
- $when = 'January 2';
- // Verbose method:
- if(($date = strtotime($when)) < time()) {
- $date = strtotime('+1 year', $date);
- }
- // If you need this as a one-liner...
- $date = (strtotime($when) < time()) ? strtotime('+1 year', strtotime($when)) : strtotime($when);
- echo date('m/d/Y', $date);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement