YEAR
YEAR = 31536000
offset(string $remote, string $local = NULL, mixed $now = NULL) : integer
计算两个时区间相差的时长,单位为秒
$seconds = self::offset('America/Chicago', 'GMT');
[!!] A list of time zones that PHP supports can be found at http://php.net/timezones.
string | $remote | timezone that to find the offset of |
string | $local | timezone used as the baseline |
mixed | $now | UNIX timestamp or date string |
span(integer $remote, integer $local = NULL, string $output = 'years,months,weeks,days,hours,minutes,seconds') : string
计算两个时间戳之间相差的时间
$span = self::span(60, 182, 'minutes,seconds'); // array('minutes' => 2, 'seconds' => 2) $span = self::span(60, 182, 'minutes'); // 2
integer | $remote | timestamp to find the span of |
integer | $local | timestamp to use as the baseline |
string | $output | formatting string |
when only a single output is requested
unixtime(string $type = 'day', integer $offset, string $position = 'begin', integer $year = null, integer $month = null, integer $day = null, integer $hour = null, integer $minute = null) : integer
获取一个基于时间偏移的Unix时间戳
string | $type | 时间类型,默认为day,可选minute,hour,day,week,month,quarter,year |
integer | $offset | 时间偏移量 默认为0,正数表示当前type之后,负数表示当前type之前 |
string | $position | 时间的开始或结束,默认为begin,可选前(begin,start,first,front),end |
integer | $year | 基准年,默认为null,即以当前年为基准 |
integer | $month | 基准月,默认为null,即以当前月为基准 |
integer | $day | 基准天,默认为null,即以当前天为基准 |
integer | $hour | 基准小时,默认为null,即以当前年小时基准 |
integer | $minute | 基准分钟,默认为null,即以当前分钟为基准 |
处理后的Unix时间戳