note 127979 added to function.date-sun-info
| From: | TheFax at main dot php dot net | Date: | Sun, 04 Dec 2022 09:27:58 +0000 |
| Subject: | note 127979 added to function.date-sun-info | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219936@lists.php.net to get a copy of this message | ||
In the last example, conversion from seconds to Hour, Minutes, Seconds is wrong.
This is the correct verion:
<?php
$si = date_sun_info(strtotime('2022-08-26'), 50.45, 30.52);
$diff = $si['sunset'] - $si['sunrise']; # $diff is measured in seconds.
echo "Length of day: ",
floor($diff / 3600), "h",
floor(($diff % 3600) / 60), "m",
floor($diff % 60), "s\n";
?>
Output:
Length of day: 13h53m15s
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.161 (proxied: 171.22.232.154)
----
Manual Page -- https://php.net/manual/en/function.date-sun-info.php
Edit -- https://main.php.net/note/edit/127979
Del: integrated -- https://main.php.net/note/delete/127979/integrated
Del: useless -- https://main.php.net/note/delete/127979/useless
Del: bad code -- https://main.php.net/note/delete/127979/bad+code
Del: spam -- https://main.php.net/note/delete/127979/spam
Del: non-english -- https://main.php.net/note/delete/127979/non-english
Del: in docs -- https://main.php.net/note/delete/127979/in+docs
Del: other reasons-- https://main.php.net/note/delete/127979
Reject -- https://main.php.net/note/reject/127979
Search -- https://main.php.net/manage/user-notes.php