首页 > 文章列表 > 在PHP中,date_sunset()函数的翻译是什么?

在PHP中,date_sunset()函数的翻译是什么?

php 翻译 date_sunset()函数
328 2023-08-19

The date_sunset() function returns the time of sunset for a given day / location.

Syntax

date_sunset(timestamp,format,latitude,longitude,zenith,gmtoffset);

参数

  • timestamp  − 从中获取日出时间的日期的时间戳。

  • format  − 指定如何返回结果

    • SUNFUNCS_RET_STRING  − 以字符串形式返回结果。

    • SUNFUNCS_RET_DOUBLE  − 以浮点数形式返回结果。

    • SUNFUNCS_RET_TIMESTAMP  − 以整数形式返回结果(时间戳)

  • latitude  − 指定位置的纬度。默认为北半球。如果要指定南半球的值,必须传递一个负值。

  • longitude  − 指定位置的经度。默认为东半球。如果要指定西半球的值,必须传递一个负值。

  • zenith  − 默认为date.sunrise_zenith

  • gmtoffset  − GMT和当地时间之间的小时差。

返回值

date_sunset()函数在成功时返回日出时间,以指定的格式。失败时返回FALSE。

示例

以下是一个示例 −

 Live Demo

<?php
   echo("Date: " . date("D M d Y") . "<br />"); echo(date_sunset(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1));
?>

输出

Date: Wed Oct 10 2018
19:02

Example

让我们看另一个例子 −

 演示

<?php
   echo date("D M d Y"); echo("

Sunset time: "); echo(date_sunset(time(), SUNFUNCS_RET_STRING, 22.9564, 85.8531, 90, 5.45)); ?>

输出

Wed Oct 10 2018 Sunset time: 17:20