YEAR
YEAR = 31536000
日期时间处理类
offset(string $remote, string $local = null, mixed $now = null) : int
计算两个时区间相差的时长,单位为秒
$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(int $remote, int $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
int | $remote | timestamp to find the span of |
int | $local | timestamp to use as the baseline |
string | $output | formatting string |
when only a single output is requested
unixtime(string $type = 'day', int $offset, string $position = 'begin', int $year = null, int $month = null, int $day = null, int $hour = null, int $minute = null) : int
获取一个基于时间偏移的Unix时间戳
string | $type | 时间类型,默认为day,可选minute,hour,day,week,month,quarter,year |
int | $offset | 时间偏移量 默认为0,正数表示当前type之后,负数表示当前type之前 |
string | $position | 时间的开始或结束,默认为begin,可选前(begin,start,first,front),end |
int | $year | 基准年,默认为null,即以当前年为基准 |
int | $month | 基准月,默认为null,即以当前月为基准 |
int | $day | 基准天,默认为null,即以当前天为基准 |
int | $hour | 基准小时,默认为null,即以当前年小时基准 |
int | $minute | 基准分钟,默认为null,即以当前分钟为基准 |
处理后的Unix时间戳