note 100112 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Thu, 09 Feb 2012 20:53:35 +0000 |
| Subject: | note 100112 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185972@lists.php.net to get a copy of this message | ||
Note Submitter: jlathrop at horizonit dot us
----
Looking to output number of days left in the current year (and check if its a leap year - here it
is)
<?php
$today = getdate(); // Get the current day in an array
$yday = ($today['yday']); // Extract just the number of days since January 1st current
year
$leap = date('L'); // check if its a leap year
$tdl = $leap + 365; // 365 days in an average year plus 1 day if its a leap year
$dliy = $tdl - $yday; //Today number of days in the current year minus number of days since
January 1st current year
// Build the output using the above variables
echo "As of today " . date('l F d, Y, ') . "We currently have " .
$dliy . " days left in the year.";
?>