zoukankan      html  css  js  c++  java
  • PHP date_sunset() 函数

    ------------恢复内容开始------------

    实例

    返回葡萄牙里斯本今天的日落时间:

    <?php
    // Lisbon, Portugal:
    // Latitude: 38.4 North, Longitude: 9 West
    // Zenith ~= 90, offset: +1 GMT

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


    运行实例 »


    定义和用法

    date_sunset() 函数返回指定日期与地点的日落时间。

    提示:请参阅 date_sunrise() 函数,返回指定日期与地点的日出时间。

    语法

    date_sunset(timestamp,format,latitude,longitude,zenith,gmtoffset);
    参数描述
    timestamp 必需。规定要计算日落时间的日期时间戳。
    format

    可选。规定如何返回结果:

    • SUNFUNCS_RET_STRING(以 string 格式返回结果,比如 16:46)(默认)
    • SUNFUNCS_RET_DOUBLE(以 float 格式返回结果,比如 16.78243132)
    • SUNFUNCS_RET_TIMESTAMP(以 integer 格式(时间戳)返回结果,比如 1095034606)
    latitude 可选。规定地点的纬度。默认是指北纬。因此如果要指定南纬,必须传递一个负值。
    longitude 可选。规定地点的经度。默认是指东经。因此如果要指定西经,必须传递一个负值。
    zenith 可选。默认为 date.sunset_zenith。
    gmtoffset 可选。规定 GMT 与本地时间的差值。单位是小时。

    技术细节

    返回值: 如果成功,则以指定的 format 返回日落时间。如果失败则返回 FALSE。
    PHP 版本: 5+高佣联盟 www.cgewang.com
    更新日志: 从 PHP 5.1.0 开始,该函数报 E_STRICT 和 E_NOTICE 时区错误。

    ------------恢复内容结束------------

  • 相关阅读:
    Solidity notes
    Solidity by Example详解
    基本命令中部
    基本命令上部
    服务器介绍
    Linux发展史及安装
    ERROR: Unrecognized command line argument: 'use'
    RequireJs 深入理解
    Redis 安装教程 (Windows 2.6.13 稳定版)
    System.AccessViolationException: 尝试读取或写入受保护的内存 解决办法
  • 原文地址:https://www.cnblogs.com/yc10086/p/12988624.html
Copyright © 2011-2022 走看看