note 101018 added to function.date

From: Date: Sat, 20 Nov 2010 16:40:49 +0000
Subject: note 101018 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-174226@lists.php.net to get a copy of this message
A really simple way to check if today's the last day of the month: <?php // If today is the last day of the month, do stuff if(date('j') == date('t')) { // Do Stuff } ?> An even simpler way to check if today is the first day of the month: <?php // If today is the first day of the month, do more stuff if(date('j') == 1) { // Do More Stuff } ?> By the way, the last one was a joke. That one should'a been obvious. ;) Sure, the first one is also relatively obvious, but some people don't know about date('t') so there ya go. ---- Server IP: 64.71.164.2 Probable Submitter: 24.53.167.6 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/101018 Del: integrated -- https://master.php.net/note/delete/101018/integrated Del: useless -- https://master.php.net/note/delete/101018/useless Del: bad code -- https://master.php.net/note/delete/101018/bad+code Del: spam -- https://master.php.net/note/delete/101018/spam Del: non-english -- https://master.php.net/note/delete/101018/non-english Del: in docs -- https://master.php.net/note/delete/101018/in+docs Del: other reasons-- https://master.php.net/note/delete/101018 Reject -- https://master.php.net/note/reject/101018 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174226) next »