date_sun(rise|set) fails if the sun does not rise or set

This integrates user note 114896.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344215 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2018-02-11 16:01:56 +00:00
parent 335b42f561
commit 7e4c47b05c
2 changed files with 40 additions and 2 deletions

View file

@ -114,7 +114,9 @@
&reftitle.returnvalues;
<para>
Returns the sunrise time in a specified <parameter>format</parameter> on
success&return.falseforfailure;.
success&return.falseforfailure;. One potential reason for failure is that the
sun does not rise at all, which happens inside the polar circles for part of
the year.
</para>
</refsect1>
@ -171,6 +173,23 @@ echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), SUNFUNCS_RET_STR
<screen>
<![CDATA[
Mon Dec 20 2004, sunrise time : 08:54
]]>
</screen>
</example>
<example>
<title>No sunrise</title>
<programlisting role="php">
<![CDATA[
<?php
$solstice = strtotime('2017-12-21');
var_dump(date_sunrise($solstice, SUNFUNCS_RET_STRING, 69.245833, -53.537222));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
]]>
</screen>
</example>

View file

@ -144,7 +144,9 @@
&reftitle.returnvalues;
<para>
Returns the sunset time in a specified <parameter>format</parameter> on
success&return.falseforfailure;.
success&return.falseforfailure;. One potential reason for failure is that the
sun does not set at all, which happens inside the polar circles for part of
the year.
</para>
</refsect1>
@ -173,6 +175,23 @@ echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRIN
<screen>
<![CDATA[
Mon Dec 20 2004, sunset time : 18:13
]]>
</screen>
</example>
<example>
<title>No sunset</title>
<programlisting role="php">
<![CDATA[
<?php
$solstice = strtotime('2017-12-21');
var_dump(date_sunset($solstice, SUNFUNCS_RET_STRING, 69.245833, -53.537222));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(false)
]]>
</screen>
</example>