ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DateTime.php
Go to the documentation of this file.
1<?php
2
4
5use DateTimeInterface;
6
11{
24 public static function isLeapYear($year)
25 {
27 }
28
41 public static function getDateValue($dateValue)
42 {
43 try {
44 return DateTimeExcel\Helpers::getDateValue($dateValue);
45 } catch (Exception $e) {
46 return $e->getMessage();
47 }
48 }
49
72 public static function DATETIMENOW()
73 {
75 }
76
99 public static function DATENOW()
100 {
102 }
103
159 public static function DATE($year = 0, $month = 1, $day = 1)
160 {
161 return DateTimeExcel\Date::fromYMD($year, $month, $day);
162 }
163
195 public static function TIME($hour = 0, $minute = 0, $second = 0)
196 {
197 return DateTimeExcel\Time::fromHMS($hour, $minute, $second);
198 }
199
230 public static function DATEVALUE($dateValue)
231 {
232 return DateTimeExcel\DateValue::fromString($dateValue);
233 }
234
261 public static function TIMEVALUE($timeValue)
262 {
263 return DateTimeExcel\TimeValue::fromString($timeValue);
264 }
265
285 public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
286 {
287 return DateTimeExcel\Difference::interval($startDate, $endDate, $unit);
288 }
289
310 public static function DAYS($endDate = 0, $startDate = 0)
311 {
312 return DateTimeExcel\Days::between($endDate, $startDate);
313 }
314
348 public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
349 {
350 return DateTimeExcel\Days360::between($startDate, $endDate, $method);
351 }
352
385 public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
386 {
387 return DateTimeExcel\YearFrac::fraction($startDate, $endDate, $method);
388 }
389
414 public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
415 {
416 return DateTimeExcel\NetworkDays::count($startDate, $endDate, ...$dateArgs);
417 }
418
445 public static function WORKDAY($startDate, $endDays, ...$dateArgs)
446 {
447 return DateTimeExcel\WorkDay::date($startDate, $endDays, ...$dateArgs);
448 }
449
469 public static function DAYOFMONTH($dateValue = 1)
470 {
471 return DateTimeExcel\DateParts::day($dateValue);
472 }
473
497 public static function WEEKDAY($dateValue = 1, $style = 1)
498 {
499 return DateTimeExcel\Week::day($dateValue, $style);
500 }
501
510
519
528
537
546
555
564
573
582
590 const DOW_SUNDAY = 1;
591
599 const DOW_MONDAY = 2;
600
608 const DOW_TUESDAY = 3;
609
617 const DOW_WEDNESDAY = 4;
618
626 const DOW_THURSDAY = 5;
627
635 const DOW_FRIDAY = 6;
636
644 const DOW_SATURDAY = 7;
645
654
662 const METHODARR = [
663 self::STARTWEEK_SUNDAY => self::DOW_SUNDAY,
665 self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY,
672 self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO,
673 ];
674
709 public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY)
710 {
711 return DateTimeExcel\Week::number($dateValue, $method);
712 }
713
732 public static function ISOWEEKNUM($dateValue = 1)
733 {
734 return DateTimeExcel\Week::isoWeekNumber($dateValue);
735 }
736
756 public static function MONTHOFYEAR($dateValue = 1)
757 {
758 return DateTimeExcel\DateParts::month($dateValue);
759 }
760
780 public static function YEAR($dateValue = 1)
781 {
782 return DateTimeExcel\DateParts::year($dateValue);
783 }
784
804 public static function HOUROFDAY($timeValue = 0)
805 {
806 return DateTimeExcel\TimeParts::hour($timeValue);
807 }
808
828 public static function MINUTE($timeValue = 0)
829 {
830 return DateTimeExcel\TimeParts::minute($timeValue);
831 }
832
852 public static function SECOND($timeValue = 0)
853 {
854 return DateTimeExcel\TimeParts::second($timeValue);
855 }
856
882 public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
883 {
884 return DateTimeExcel\Month::adjust($dateValue, $adjustmentMonths);
885 }
886
911 public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
912 {
913 return DateTimeExcel\Month::lastDay($dateValue, $adjustmentMonths);
914 }
915}
An exception for terminatinating execution or to throw for unit testing.
static fromYMD($year, $month, $day)
DATE.
Definition: Date.php:61
static between($startDate=0, $endDate=0, $method=false)
DAYS360.
Definition: Days360.php:39
static between($endDate, $startDate)
DAYS.
Definition: Days.php:27
static interval($startDate, $endDate, $unit='D')
DATEDIF.
Definition: Difference.php:24
static getDateValue($dateValue, bool $allowBool=true)
getDateValue.
Definition: Helpers.php:31
static isLeapYear($year)
Identify if a year is a leap year or not.
Definition: Helpers.php:19
static lastDay($dateValue, $adjustmentMonths)
EOMONTH.
Definition: Month.php:64
static adjust($dateValue, $adjustmentMonths)
EDATE.
Definition: Month.php:29
static count($startDate, $endDate,... $dateArgs)
NETWORKDAYS.
Definition: NetworkDays.php:29
static fromHMS($hour, $minute, $second)
TIME.
Definition: Time.php:38
static number($dateValue, $method=Constants::STARTWEEK_SUNDAY)
WEEKNUM.
Definition: Week.php:41
static isoWeekNumber($dateValue)
ISOWEEKNUM.
Definition: Week.php:94
static day($dateValue, $style=1)
WEEKDAY.
Definition: Week.php:131
static date($startDate, $endDays,... $dateArgs)
WORKDAY.
Definition: WorkDay.php:31
static fraction($startDate, $endDate, $method=0)
YEARFRAC.
Definition: YearFrac.php:37
static DAYS360($startDate=0, $endDate=0, $method=false)
DAYS360.
Definition: DateTime.php:348
static DATE($year=0, $month=1, $day=1)
DATE.
Definition: DateTime.php:159
static DATEDIF($startDate=0, $endDate=0, $unit='D')
DATEDIF.
Definition: DateTime.php:285
static WORKDAY($startDate, $endDays,... $dateArgs)
WORKDAY.
Definition: DateTime.php:445
static MINUTE($timeValue=0)
MINUTE.
Definition: DateTime.php:828
static isLeapYear($year)
Identify if a year is a leap year or not.
Definition: DateTime.php:24
static DATEVALUE($dateValue)
DATEVALUE.
Definition: DateTime.php:230
const STARTWEEK_SUNDAY_ALT
STARTWEEK_SUNDAY_ALT.
Definition: DateTime.php:581
static WEEKNUM($dateValue=1, $method=self::STARTWEEK_SUNDAY)
WEEKNUM.
Definition: DateTime.php:709
const STARTWEEK_MONDAY_ISO
STARTWEEK_MONDAY_ISO.
Definition: DateTime.php:653
const STARTWEEK_TUESDAY
STARTWEEK_TUESDAY.
Definition: DateTime.php:536
static TIME($hour=0, $minute=0, $second=0)
TIME.
Definition: DateTime.php:195
static SECOND($timeValue=0)
SECOND.
Definition: DateTime.php:852
static DAYS($endDate=0, $startDate=0)
DAYS.
Definition: DateTime.php:310
const STARTWEEK_WEDNESDAY
STARTWEEK_WEDNESDAY.
Definition: DateTime.php:545
static NETWORKDAYS($startDate, $endDate,... $dateArgs)
NETWORKDAYS.
Definition: DateTime.php:414
static EDATE($dateValue=1, $adjustmentMonths=0)
EDATE.
Definition: DateTime.php:882
static YEARFRAC($startDate=0, $endDate=0, $method=0)
YEARFRAC.
Definition: DateTime.php:385
static EOMONTH($dateValue=1, $adjustmentMonths=0)
EOMONTH.
Definition: DateTime.php:911
static TIMEVALUE($timeValue)
TIMEVALUE.
Definition: DateTime.php:261
static MONTHOFYEAR($dateValue=1)
MONTHOFYEAR.
Definition: DateTime.php:756
static WEEKDAY($dateValue=1, $style=1)
WEEKDAY.
Definition: DateTime.php:497
static ISOWEEKNUM($dateValue=1)
ISOWEEKNUM.
Definition: DateTime.php:732
const STARTWEEK_MONDAY_ALT
STARTWEEK_MONDAY_ALT.
Definition: DateTime.php:527
const STARTWEEK_THURSDAY
STARTWEEK_THURSDAY.
Definition: DateTime.php:554
const STARTWEEK_SATURDAY
STARTWEEK_SATURDAY.
Definition: DateTime.php:572
static DAYOFMONTH($dateValue=1)
DAYOFMONTH.
Definition: DateTime.php:469
static getDateValue($dateValue)
getDateValue.
Definition: DateTime.php:41
static HOUROFDAY($timeValue=0)
HOUROFDAY.
Definition: DateTime.php:804
$style
Definition: example_012.php:70