note 92600 deleted from function.strtotime by crell

From: Date: Thu, 30 Jun 2022 20:58:41 +0000
Subject: note 92600 deleted from function.strtotime by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218816@lists.php.net to get a copy of this message
Note Submitter: php at davidstockton dot com ---- Adding a note to an already long page: Try to be as specific as you can with the string you pass in. For example <?php echo date('F', strtotime('February')); ?> is not specific enough. Depending on the day of the month, you may get a different response. For a non-leap year, you'll get March if the _current day of the month_ is the 29th, 30th or 31st. If it's a leap year, you'll get March on the 30th or 31st of the month. The same thing will happen on the 31st of any month when you pass in the name of any month with less than 31 days. This happens because the strtotime() function will fill in missing parts from the current day. Assuming today is July 31, the timestamp returned by strtotime('February') will ultimately be seen as February 31 (non-existant obviously), which then is interpreted as March 3, thus giving a month name of March. Interestingly, adding the year or the day will give you back the expected month.

« previous php.notes (#218816) next »