dateperiod php,DatePeriod 类 - PHP 7 中文文档

(PHP 5 >= 5.3.0, PHP 7)

简介

DatePeriod 类表示一个时间周期。

一个时间周期可以用来在给定的一段时间之内,

以一定的时间间隔进行迭代。

类摘要

DatePeriod

implements

Traversable

{

/* 常量 */

const

integer

EXCLUDE_START_DATE

= 1

;

/* 属性 */

public

integer

$recurrences

;

public

boolean

$include_start_date

;

public

[DateTimeInterface](php7/class.datetimeinterface)

$start

;

public

[DateTimeInterface](php7/class.datetimeinterface)

$current

;

public

[DateTimeInterface](php7/class.datetimeinterface)

$end

;

public

[DateInterval](php7/class.dateinterval)

$interval

;

/* 方法 */

public [__construct](php7/dateperiod.construct)

( [DateTimeInterface](php7/class.datetimeinterface) $start

, [DateInterval](php7/class.dateinterval) $interval

, int $recurrences

[, int $options

] )

public [__construct](php7/dateperiod.construct)

( [DateTimeInterface](php7/class.datetimeinterface) $start

, [DateInterval](php7/class.dateinterval) $interval

, [DateTimeInterface](php7/class.datetimeinterface) $end

[, int $options

] )

public [__construct](php7/dateperiod.construct)

( string $isostr

[, int $options

] )

public [getDateInterval](php7/dateperiod.getdateinterval)

( void

) : [DateInterval](php7/class.dateinterval)

public [getEndDate](php7/dateperiod.getenddate)

( void

) : [DateTimeInterface](php7/class.datetimeinterface)

public [getStartDate](php7/dateperiod.getstartdate)

( void

) : [DateTimeInterface](php7/class.datetimeinterface)

}

预定义常量

DatePeriod::EXCLUDE_START_DATE

在 [DatePeriod::__construct()](php7/dateperiod.construct) 构造函数中使用,表示不包含开始时间。

属性

recurrences

循环次数。

include_start_date

在循环过程中,是否包含开始时间。

start

时间周期的开始时间。

current

表示在时间周期内迭代的时候,当前的时间。

end

时间周期的结束时间。

interval

ISO 8601 格式的间隔。

更新日志

版本

说明

5.3.27, 5.4.17

公开以下属性:recurrences,

include_start_date,start,

current,end 和

interval。

Table of Contents

DatePeriod::__construct — Creates a new DatePeriod object

DatePeriod::getDateInterval — Gets the interval

DatePeriod::getEndDate — Gets the end date

DatePeriod::getStartDate — Gets the start date

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值