summaryrefslogtreecommitdiff
path: root/ext/date/tests/date_sunrise_and_sunset_basic.phpt
blob: 6224c4bd3ffe5384f371dc2eed06240e4602dc01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
Basic test for date_sunrise and date_sunset based on example in PHP manual
--FILE--
<?php

date_default_timezone_set('UTC');

/* calculate the sunrise time for Lisbon, Portugal
Latitude: 38.4 North
Longitude: 9 West
Zenith ~= 90
offset: +1 GMT
*/

echo "Basic test for date_sunrise() and date_sunset()\n";

// suppress date() function strict msgs
error_reporting(E_ALL & ~E_STRICT);

echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";

?>
===Done===
--EXPECTF--
Basic test for date_sunrise() and date_sunset()
%s %s %d %d, sunrise time : %d:%d
%s %s %d %d, sunset time : %d:%d
===Done===