note 49196 deleted from function.date by tularis

From: Date: Sun, 30 Jan 2005 14:37:03 +0000
Subject: note 49196 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84236@lists.php.net to get a copy of this message
Note Submitter: xsmokex at chello dot at ---- i had to make a function that checks if a file in dmY.txt format exist if yes create d+1mY.txt as there isnt such function!? i wrote my own perhabs usefull maybe for a calendar? as it returns valid dates without knowing when month/year ends :) <?php function nextday($day,$code) { $tempvalue = "+".$day." day"; $tempdate = getdate(strtotime($tempvalue)); $rday = $tempdate['mday']; if (strlen($rday) == 1) { $rday = "0".$rday; } $rmon = $tempdate['mon']; if (strlen($rmon) == 1) { $rmon = "0".$rmon; } $ryear = $tempdate['year']; if ($code == "T") { return $rday.".".$rmon.".".$ryear; } if ($code == "C") { return $rday.$rmon.$ryear; } } ?> (c for code t for text anyway u could edit it in whatever way u want) Today 19.01.2005 $testdate = nextday(1,T); echo $testdate; echo "<br>\n"; $testdate = nextday(15,C); echo $testdate; would return 20.01.2005 03022005 hope its usefull for someone

« previous php.notes (#84236) next »