note 36796 added to function.mktime

From: Date: Wed, 22 Oct 2003 19:15:32 +0000
Subject: note 36796 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-59145@lists.php.net to get a copy of this message
This function cals the different days between today and given date. function daysDiff($y1, $m1, $d1) { $y2 = date("Y"); $m2 = date("m"); $d2 = date("d"); $y = $y1 - $y2; $m = $m1 - $m2; $d = $d1 - $d2; $daysInMonth = date("t",$m1); if ($d<0) {$m--;$d=$d+$daysInMonth;} if ($m<0) {$y--;$m=$m+12;} if ($y) $diff .= $y==1 ? "1 year " : "$y years "; if ($m) $diff .= $m==1? "1 month and " : "$m months and "; if ($d) $diff .= $d==1 ? "1 day " : "$d days "; return $diff; } April :) ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36796 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36796&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36796&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59145) next »