When

PHP Date Recursion library

  • 所有者: tplaner/When
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

When

Date/Calendar recursion library for PHP 7.1+

Build Status
Total Downloads

Author: Tom Planer

Installation

composer require tplaner/When

Current Features

Currently this version does everything version 1 was capable of, it also supports byhour, byminute, and bysecond. Please check the unit tests for information about how to use it.

Here are some basic examples.

// friday the 13th for the next 5 occurrences
$r = new When();
$r->startDate(new DateTime("19980213T090000"))
  ->freq("monthly")
  ->count(5)
  ->byday("fr")
  ->bymonthday(13)
  ->generateOccurrences();

print_r($r->occurrences);
// friday the 13th for the next 5 occurrences rrule
$r = new When();
$r->startDate(new DateTime("19980213T090000"))
  ->rrule("FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13")
  ->generateOccurrences();

print_r($r->occurrences);
// friday the 13th for the next 5 occurrences, skipping known friday the 13ths
$r = new When();
$r->startDate(new DateTime("19980213T090000"))
  ->freq("monthly")
  ->count(5)
  ->byday("fr")
  ->bymonthday(13)
  ->exclusions('19990813T090000,20001013T090000')
  ->generateOccurrences();

print_r($r->occurrences);
// friday the 13th forever; see which ones occur in 2018
$r = new When();
$r->startDate(new DateTime("19980213T090000"))
  ->rrule("FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13");

$occurrences = $r->getOccurrencesBetween(new DateTime('2018-01-01 09:00:00'),
                                         new DateTime('2019-01-01 09:00:00'));
print_r($occurrences);

License

When is licensed under the MIT License, see LICENSE for specific details.

主要指標

概覽
名稱與所有者tplaner/When
主編程語言PHP
編程語言PHP (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2010-09-04 00:23:05
推送於2025-02-14 01:18:32
最后一次提交2025-02-13 20:17:11
發布數16
最新版本名稱v3.2.1 (發布於 2025-02-13 20:18:12)
第一版名稱v0.1 (發布於 )
用户参与
星數520
關注者數25
派生數96
提交數146
已啟用問題?
問題數65
打開的問題數2
拉請求數21
打開的拉請求數0
關閉的拉請求數11
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?