日期类¶
属性 | 值 |
---|---|
命名空间 | fize\datetime |
类名 | Date |
父类 | DateTime |
实现接口 | DateTimeInterface |
常量: |
---|
名称 | 值 | 说明 |
---|---|---|
ATOM | “Y-m-d\TH:i:sP” | |
COOKIE | “l, d-M-Y H:i:s T” | |
ISO8601 | “Y-m-d\TH:i:sO” | |
RFC822 | “D, d M y H:i:s O” | |
RFC850 | “l, d-M-y H:i:s T” | |
RFC1036 | “D, d M y H:i:s O” | |
RFC1123 | “D, d M Y H:i:s O” | |
RFC7231 | “D, d M Y H:i:s \G\M\T” | |
RFC2822 | “D, d M Y H:i:s O” | |
RFC3339 | “Y-m-d\TH:i:sP” | |
RFC3339_EXTENDED | “Y-m-d\TH:i:s.vP” | |
RSS | “D, d M Y H:i:s O” | |
W3C | “Y-m-d\TH:i:sP” |
方法: |
---|
方法名 | 说明 |
---|---|
check() | 检查由参数构成的日期的合法性。 |
parseFromFormat() | 获取根据指定格式格式化的给定日期的信息 |
parse() | 返回有关给定日期的详细信息的关联数组 |
sunInfo() | 返回一个包含日落/日出和黄昏开始/结束信息的数组 |
sunrise() | 返回给定的日期与地点的日出时间 |
sunset() | 返回给定的日期与地点的日落时间 |
getdate() | 取得日期/时间信息 |
gmdate() | 格式化一个 GMT/UTC 日期/时间 |
idate() | 将本地时间日期格式化为整数 |
常量¶
ATOM¶
修饰符: | public |
---|---|
类型: | string |
值: | “Y-m-d\TH:i:sP” |
COOKIE¶
修饰符: | public |
---|---|
类型: | string |
值: | “l, d-M-Y H:i:s T” |
ISO8601¶
修饰符: | public |
---|---|
类型: | string |
值: | “Y-m-d\TH:i:sO” |
RFC822¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M y H:i:s O” |
RFC850¶
修饰符: | public |
---|---|
类型: | string |
值: | “l, d-M-y H:i:s T” |
RFC1036¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M y H:i:s O” |
RFC1123¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M Y H:i:s O” |
RFC7231¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M Y H:i:s \G\M\T” |
RFC2822¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M Y H:i:s O” |
RFC3339¶
修饰符: | public |
---|---|
类型: | string |
值: | “Y-m-d\TH:i:sP” |
RFC3339_EXTENDED¶
修饰符: | public |
---|---|
类型: | string |
值: | “Y-m-d\TH:i:s.vP” |
RSS¶
修饰符: | public |
---|---|
类型: | string |
值: | “D, d M Y H:i:s O” |
W3C¶
修饰符: | public |
---|---|
类型: | string |
值: | “Y-m-d\TH:i:sP” |
方法¶
check()¶
检查由参数构成的日期的合法性。
public static function check (
int $month,
int $day,
int $year
) : bool
参数: |
|
---|
如果每个参数都正确定义了则会被认为是有效的。
参数 `$day` :
闰年已经考虑进去了。
parseFromFormat()¶
获取根据指定格式格式化的给定日期的信息
public static function parseFromFormat (
string $format,
string $date
) : array
参数: |
|
---|
parse()¶
返回有关给定日期的详细信息的关联数组
public static function parse (
string $date
) : array
参数: |
|
||||
---|---|---|---|---|---|
返回值: | 失败时返回false |
sunInfo()¶
返回一个包含日落/日出和黄昏开始/结束信息的数组
public static function sunInfo (
int $time,
float $latitude,
float $longitude
) : array
参数: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
返回值: | 失败时返回false |
sunrise()¶
返回给定的日期与地点的日出时间
public static function sunrise (
int $timestamp,
int $format = null,
float $latitude = null,
float $longitude = null,
float $zenith = null,
float $gmt_offset = null
) : mixed
参数: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
返回值: | 按指定格式 format 返回的日出时间, 或者在失败时返回 FALSE。 |
sunset()¶
返回给定的日期与地点的日落时间
public static function sunset (
int $timestamp,
int $format = null,
float $latitude = null,
float $longitude = null,
float $zenith = null,
float $gmt_offset = null
) : mixed
参数: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
返回值: | 按指定格式 format 返回的日出时间, 或者在失败时返回 FALSE。 |
getdate()¶
取得日期/时间信息
public static function getdate (
int $timestamp = null
) : array
参数: |
|
---|
gmdate()¶
格式化一个 GMT/UTC 日期/时间
public static function gmdate (
string $format,
int $timestamp = null
) : string
参数: |
|
||||||
---|---|---|---|---|---|---|---|
返回值: | 失败时返回false |
idate()¶
将本地时间日期格式化为整数
public static function idate (
string $format,
int $timestamp = null
) : int
参数: |
|
---|