Keys →
Functions ↓
function dateRange ( $start, $dur ) {#-k datetime format#- Describe a date range - determines whether to include cross-year, cross-month or just days.#-s See also: dateDiff formatTime secondsToInterval since time2secs date $a = strtotime ( $start ); $b = strtotime ( $start . '+' . $dur ); $ar = getdate ( $a ); $br = getdate ( $b ); if ($ar['year'] <> $br['year']) { # range goes into next year $d = date("F j, Y",$a) . ' - ' . date("F j, Y",$b); } else if ($ar['mon'] <> $br['mon']) { # range goes into next month $d = date("F j",$a) . ' - ' . date("F j, Y",$b); } else { # just different days $d = date("F j",$a) . '-' . date("j, Y",$b); } return $d; }?>