note 101018 modified in function.date by danbrown

From: Date: Sat, 20 Nov 2010 17:19:56 +0000
Subject: note 101018 modified in function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-174227@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 } ?> --was-- 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. http://php.net/manual/en/function.date.php

« previous php.notes (#174227) next »