本脚本发布之日起即为最终版本,不再更新。如果使用更新版本的 PHP 与浏览器,请自行检查是否兼容。
丁俊尧
PHP(>=5)
JSON
UTF-8
sunget.php - 执行标题所述功能的文件
demo.html - 演示文件
README.md - 自述文档
lng - 经度
lat - 纬度
localOffset - 客户端时区,只写数字(例:UTC+8 -> 8;UTC -> 0;UTC-8 -> -8)
示例:{"sunrise":"05:49","sunset":"19:34","period":"day","period_exact_chinese":"下午","period_exact_western":"afternoon"}
sunrise - 日出时间,时:分,均为两位数,极昼极夜为"null"
sunset - 日落时间,时:分,均为两位数,极昼极夜为"null"
period - 粗略的时段,有两个值:day,nighttime
period_exact_chinese - 中式精确时段,有七个值:上午,中午,下午,晚上,凌晨,白天,黑夜 (后两个值仅用于极昼极夜)
period_exact_western - 西式精确时段,有七个值:morning,noon,afternoon,evening,night,day,nighttime (后两个值仅用于极昼极夜)
精确时段划分依据请见“规定”一节。
在白天(day),从日出开始白天的5/12~7/12为中午(noon),此时间段之前为上午(morning),之后为下午(afternoon);
在黑夜(nighttime),前1/4为evening,后3/4为night;黑夜的前半部分为晚上,后半部分为凌晨。
白天、中午占有两端点值。evening、晚上占有结束端点值。
极昼视为白天(day),极夜视为黑夜(nighttime)。
danatauthenticdesign.net 提供的计算两个时区的时间差的PHP函数
http://php.net/manual/zh/function.timezone-offset-get.php
请在使用该脚本时署上我的名字,谢谢!
The scripts is the final version since published. If you are using a newer version of PHP and your browser, check for compatibility yourself.
Ding Junyao
PHP (>=5)
JSON
UTF-8
sunget.php - File which execulate the functions the title said
demo.html - Demo File
README.md - Readme File
lng - Longtitude
lat - Latitude
localOffset - The offset number of the client, only numbers(eg. UTC+8 ->8; UTC -> 0; UTC-8 -> -8).
Example:{"sunrise":"05:49","sunset":"19:34","period":"day","period_exact_chinese":"下午","period_exact_western":"afternoon"}
sunrise - The sunrise time, HH:MM, it's "null" when polar day or polar night
sunset - The sunrise time, HH:MM, it's "null" when polar day or polar night
period - Rough period, two values:day,nighttime
period_exact_chinese - Chinese exact period, seven values:上午,中午,下午,晚上,凌晨,白天,黑夜 (the last two values are only used in polar day and polar night)
period_exact_western - Western exact period, seven values:morning,noon,afternoon,evening,night,day,nighttime (the last two values are only used in polar day and polar night)
Please read Note to learn the rule of dividing the time into exact periods in this script.
In daytime(day,白天), from the sunrise time, the 5/12~7/12 of the daytime is noon(中午), the period before noon is morning(早上) and the period after noon is afternoon(下午);
In nighttime(nighttime,黑夜), the former 1/4 of it is evening and the rest is night; the former half of it is 晚上 and the rest is 凌晨.
Day and noon have two points occupied, and evening and 晚上 have end points occupied.
Polar day=day, polar night=nighttime.
The PHP Function which calculates the time difference between two timezones by danatauthenticdesign.net
http://php.net/manual/zh/function.timezone-offset-get.php
PLEASE write my name when using this script, Thanks!