From 129d13b8bc0ec8037c480e4acd5a6f702e324fd4 Mon Sep 17 00:00:00 2001 From: Mike Robinson Date: Fri, 7 Jan 2000 02:34:06 +0000 Subject: [PATCH] Added reference and example of using 0 as last day of previous month git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@18475 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/datetime.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/functions/datetime.xml b/functions/datetime.xml index 0f3bed323a..c0e2736748 100644 --- a/functions/datetime.xml +++ b/functions/datetime.xml @@ -353,6 +353,20 @@ echo date( "M-d-Y", mktime(0,0,0,1,1,1998) ); + + The last day of any given month can be expressed as the "0" day + of the next month, not the -1 day. Both of the following examples + will produce the string "The last day in Feb 2000 is: 29". + + +$lastday=mktime(0,0,0,3,0,2000); +echo strftime("Last day in Feb 2000 is: %d",$lastday); + +$lastday=mktime(0,0,0,4,-31,2000); +echo strftime("Last day in Feb 2000 is: %d",$lastday); + + + See also date and time.