I need help to write a function that will return the days date, say “Friday, December 9”. But if it is a Saturday or Sunday it will return the following Mondays date. So say its Saturday, December 10 it will return “Monday, December 12”.
thank you.
[code=php]function getFutureDate($time = 0) { if (!$time) {$time = time();} $dow = (int)date('w', $time); return date('l, F j', $time + (86400 * ($dow === 0 ? 1 : ($dow === 6 ? 2 : 0)))); } echo getFutureDate() . '<br />'; //TODAY echo getFutureDate(time() + (86400 * 1)) . '<br />'; //TOMORROW echo getFutureDate(time() + (86400 * 2)) . '<br />'; //AFTER TOMORROW echo getFutureDate(time() + (86400 * -1)) . '<br />'; //YESTERDAY echo getFutureDate(time() + (86400 * -2)) . '<br />'; //BEFORE YESTERDAY[/code]
Help @TrueC11 spread the word by sharing this article on Twitter...