ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Calculation\DateTime Class Reference
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Calculation\DateTime:

Static Public Member Functions

static isLeapYear ($year)
 Identify if a year is a leap year or not. More...
 
static getDateValue ($dateValue)
 getDateValue. More...
 
static DATETIMENOW ()
 DATETIMENOW. More...
 
static DATENOW ()
 DATENOW. More...
 
static DATE ($year=0, $month=1, $day=1)
 DATE. More...
 
static TIME ($hour=0, $minute=0, $second=0)
 TIME. More...
 
static DATEVALUE ($dateValue)
 DATEVALUE. More...
 
static TIMEVALUE ($timeValue)
 TIMEVALUE. More...
 
static DATEDIF ($startDate=0, $endDate=0, $unit='D')
 DATEDIF. More...
 
static DAYS ($endDate=0, $startDate=0)
 DAYS. More...
 
static DAYS360 ($startDate=0, $endDate=0, $method=false)
 DAYS360. More...
 
static YEARFRAC ($startDate=0, $endDate=0, $method=0)
 YEARFRAC. More...
 
static NETWORKDAYS ($startDate, $endDate,... $dateArgs)
 NETWORKDAYS. More...
 
static WORKDAY ($startDate, $endDays,... $dateArgs)
 WORKDAY. More...
 
static DAYOFMONTH ($dateValue=1)
 DAYOFMONTH. More...
 
static WEEKDAY ($dateValue=1, $style=1)
 WEEKDAY. More...
 
static WEEKNUM ($dateValue=1, $method=self::STARTWEEK_SUNDAY)
 WEEKNUM. More...
 
static ISOWEEKNUM ($dateValue=1)
 ISOWEEKNUM. More...
 
static MONTHOFYEAR ($dateValue=1)
 MONTHOFYEAR. More...
 
static YEAR ($dateValue=1)
 YEAR. More...
 
static HOUROFDAY ($timeValue=0)
 HOUROFDAY. More...
 
static MINUTE ($timeValue=0)
 MINUTE. More...
 
static SECOND ($timeValue=0)
 SECOND. More...
 
static EDATE ($dateValue=1, $adjustmentMonths=0)
 EDATE. More...
 
static EOMONTH ($dateValue=1, $adjustmentMonths=0)
 EOMONTH. More...
 

Data Fields

const STARTWEEK_SUNDAY = 1
 STARTWEEK_SUNDAY. More...
 
const STARTWEEK_MONDAY = 2
 STARTWEEK_MONDAY. More...
 
const STARTWEEK_MONDAY_ALT = 11
 STARTWEEK_MONDAY_ALT. More...
 
const STARTWEEK_TUESDAY = 12
 STARTWEEK_TUESDAY. More...
 
const STARTWEEK_WEDNESDAY = 13
 STARTWEEK_WEDNESDAY. More...
 
const STARTWEEK_THURSDAY = 14
 STARTWEEK_THURSDAY. More...
 
const STARTWEEK_FRIDAY = 15
 STARTWEEK_FRIDAY. More...
 
const STARTWEEK_SATURDAY = 16
 STARTWEEK_SATURDAY. More...
 
const STARTWEEK_SUNDAY_ALT = 17
 STARTWEEK_SUNDAY_ALT. More...
 
const DOW_SUNDAY = 1
 DOW_SUNDAY. More...
 
const DOW_MONDAY = 2
 DOW_MONDAY. More...
 
const DOW_TUESDAY = 3
 DOW_TUESDAY. More...
 
const DOW_WEDNESDAY = 4
 DOW_WEDNESDAY. More...
 
const DOW_THURSDAY = 5
 DOW_THURSDAY. More...
 
const DOW_FRIDAY = 6
 DOW_FRIDAY. More...
 
const DOW_SATURDAY = 7
 DOW_SATURDAY. More...
 
const STARTWEEK_MONDAY_ISO = 21
 STARTWEEK_MONDAY_ISO. More...
 
const METHODARR
 METHODARR. More...
 

Detailed Description

Deprecated:
1.18.0

Definition at line 10 of file DateTime.php.

Member Function Documentation

◆ DATE()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE (   $year = 0,
  $month = 1,
  $day = 1 
)
static

DATE.

The DATE function returns a value that represents a particular date.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: DATE(year,month,day)

1.18.0

DateTimeExcel::fromYMD() Use the fromYMD method in the DateTimeExcel class instead

PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function. A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted, as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.

Parameters
int$yearThe value of the year argument can include one to four digits. Excel interprets the year argument according to the configured date system: 1900 or 1904. If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108). If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008. If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value.
int$monthA positive or negative integer representing the month of the year from 1 to 12 (January to December). If month is greater than 12, month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009. If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.
int$dayA positive or negative integer representing the day of the month from 1 to 31. If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008. If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 159 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Date\fromYMD().

160  {
161  return DateTimeExcel\Date::fromYMD($year, $month, $day);
162  }
static fromYMD($year, $month, $day)
DATE.
Definition: Date.php:61
+ Here is the call graph for this function:

◆ DATEDIF()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF (   $startDate = 0,
  $endDate = 0,
  $unit = 'D' 
)
static

DATEDIF.

Excel Function: DATEDIF(startdate, enddate, unit)

1.18.0

DateTimeExcel::interval() Use the interval method in the DateTimeExcel class instead

Parameters
mixed$startDateExcel date serial value, PHP date/time stamp, PHP DateTime object or a standard date string
mixed$endDateExcel date serial value, PHP date/time stamp, PHP DateTime object or a standard date string
string$unit
Returns
int|string Interval between the dates

Definition at line 285 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Difference\interval().

286  {
287  return DateTimeExcel\Difference::interval($startDate, $endDate, $unit);
288  }
static interval($startDate, $endDate, $unit='D')
DATEDIF.
Definition: Difference.php:24
+ Here is the call graph for this function:

◆ DATENOW()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW ( )
static

DATENOW.

Returns the current date. The NOW function is useful when you need to display the current date and time on a worksheet or calculate a value based on the current date and time, and have that value updated each time you open the worksheet.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: TODAY()

1.18.0

DateTimeExcel::today() Use the today method in the DateTimeExcel class instead

Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 99 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Current\today().

+ Here is the call graph for this function:

◆ DATETIMENOW()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW ( )
static

DATETIMENOW.

Returns the current date and time. The NOW function is useful when you need to display the current date and time on a worksheet or calculate a value based on the current date and time, and have that value updated each time you open the worksheet.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: NOW()

1.18.0

DateTimeExcel::now() Use the now method in the DateTimeExcel class instead

Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 72 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Current\now().

73  {
75  }
+ Here is the call graph for this function:

◆ DATEVALUE()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE (   $dateValue)
static

DATEVALUE.

Returns a value that represents a particular date. Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp value.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: DATEVALUE(dateValue)

1.18.0

DateTimeExcel::fromString() Use the fromString method in the DateTimeExcel class instead

Parameters
string$dateValueText that represents a date in a Microsoft Excel date format. For example, "1/30/2008" or "30-Jan-2008" are text strings within quotation marks that represent dates. Using the default date system in Excel for Windows, date_text must represent a date from January 1, 1900, to December 31, 9999. Using the default date system in Excel for the Macintosh, date_text must represent a date from January 1, 1904, to December 31, 9999. DATEVALUE returns the #VALUE! error value if date_text is out of this range.
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 230 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateValue\fromString().

231  {
232  return DateTimeExcel\DateValue::fromString($dateValue);
233  }
+ Here is the call graph for this function:

◆ DAYOFMONTH()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH (   $dateValue = 1)
static

DAYOFMONTH.

Returns the day of the month, for a specified date. The day is given as an integer ranging from 1 to 31.

Excel Function: DAY(dateValue)

1.18.0

DateTimeExcel::day() Use the day method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Returns
int|string Day of the month

Definition at line 469 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts\day().

470  {
471  return DateTimeExcel\DateParts::day($dateValue);
472  }
+ Here is the call graph for this function:

◆ DAYS()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS (   $endDate = 0,
  $startDate = 0 
)
static

DAYS.

Returns the number of days between two dates

Excel Function: DAYS(endDate, startDate)

1.18.0

DateTimeExcel::between() Use the between method in the DateTimeExcel class instead

Parameters
DateTimeInterface | float | int | string$endDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
DateTimeInterface | float | int | string$startDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Returns
int|string Number of days between start date and end date or an error

Definition at line 310 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Days\between().

311  {
312  return DateTimeExcel\Days::between($endDate, $startDate);
313  }
static between($endDate, $startDate)
DAYS.
Definition: Days.php:27
+ Here is the call graph for this function:

◆ DAYS360()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360 (   $startDate = 0,
  $endDate = 0,
  $method = false 
)
static

DAYS360.

Returns the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. Use this function to help compute payments if your accounting system is based on twelve 30-day months.

Excel Function: DAYS360(startDate,endDate[,method])

1.18.0

DateTimeExcel::between() Use the between method in the DateTimeExcel class instead

Parameters
mixed$startDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
mixed$endDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
bool$methodUS or European Method FALSE or omitted: U.S. (NASD) method. If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month. TRUE: European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month.
Returns
int|string Number of days between start date and end date

Definition at line 348 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Days360\between().

349  {
350  return DateTimeExcel\Days360::between($startDate, $endDate, $method);
351  }
static between($startDate=0, $endDate=0, $method=false)
DAYS360.
Definition: Days360.php:39
+ Here is the call graph for this function:

◆ EDATE()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE (   $dateValue = 1,
  $adjustmentMonths = 0 
)
static

EDATE.

Returns the serial number that represents the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.

Excel Function: EDATE(dateValue,adjustmentMonths)

1.18.0

DateTimeExcel::adjust() Use the adjust method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$adjustmentMonthsThe number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 882 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Month\adjust().

883  {
884  return DateTimeExcel\Month::adjust($dateValue, $adjustmentMonths);
885  }
static adjust($dateValue, $adjustmentMonths)
EDATE.
Definition: Month.php:29
+ Here is the call graph for this function:

◆ EOMONTH()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH (   $dateValue = 1,
  $adjustmentMonths = 0 
)
static

EOMONTH.

Returns the date value for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.

Excel Function: EOMONTH(dateValue,adjustmentMonths)

1.18.0

DateTimeExcel::lastDay() Use the lastDay method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$adjustmentMonthsThe number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 911 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Month\lastDay().

912  {
913  return DateTimeExcel\Month::lastDay($dateValue, $adjustmentMonths);
914  }
static lastDay($dateValue, $adjustmentMonths)
EOMONTH.
Definition: Month.php:64
+ Here is the call graph for this function:

◆ getDateValue()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::getDateValue (   $dateValue)
static

getDateValue.

1.18.0

DateTimeExcel::getDateValue() Use the getDateValue method in the DateTimeExcel class instead

Parameters
mixed$dateValue
Returns
mixed Excel date/time serial value, or string if error

Definition at line 41 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Helpers\getDateValue().

42  {
43  try {
44  return DateTimeExcel\Helpers::getDateValue($dateValue);
45  } catch (Exception $e) {
46  return $e->getMessage();
47  }
48  }
static getDateValue($dateValue, bool $allowBool=true)
getDateValue.
Definition: Helpers.php:31
+ Here is the call graph for this function:

◆ HOUROFDAY()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY (   $timeValue = 0)
static

HOUROFDAY.

Returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Excel Function: HOUR(timeValue)

1.18.0

DateTimeExcel::hour() Use the hour method in the DateTimeExcel class instead

Parameters
mixed$timeValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string
Returns
int|string Hour

Definition at line 804 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts\hour().

805  {
806  return DateTimeExcel\TimeParts::hour($timeValue);
807  }
+ Here is the call graph for this function:

◆ isLeapYear()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::isLeapYear (   $year)
static

Identify if a year is a leap year or not.

1.18.0

DateTimeExcel::isLeapYear() Use the isLeapYear method in the DateTimeExcel class instead

Parameters
int | string$yearThe year to test
Returns
bool TRUE if the year is a leap year, otherwise FALSE

Definition at line 24 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Helpers\isLeapYear().

25  {
27  }
static isLeapYear($year)
Identify if a year is a leap year or not.
Definition: Helpers.php:19
+ Here is the call graph for this function:

◆ ISOWEEKNUM()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM (   $dateValue = 1)
static

ISOWEEKNUM.

Returns the ISO 8601 week number of the year for a specified date.

Excel Function: ISOWEEKNUM(dateValue)

1.18.0

DateTimeExcel::isoWeekNumber() Use the isoWeekNumber method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Returns
int|string Week Number

Definition at line 732 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week\isoWeekNumber().

733  {
734  return DateTimeExcel\Week::isoWeekNumber($dateValue);
735  }
static isoWeekNumber($dateValue)
ISOWEEKNUM.
Definition: Week.php:94
+ Here is the call graph for this function:

◆ MINUTE()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE (   $timeValue = 0)
static

MINUTE.

Returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.

Excel Function: MINUTE(timeValue)

1.18.0

DateTimeExcel::minute() Use the minute method in the DateTimeExcel class instead

Parameters
mixed$timeValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string
Returns
int|string Minute

Definition at line 828 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts\minute().

829  {
830  return DateTimeExcel\TimeParts::minute($timeValue);
831  }
+ Here is the call graph for this function:

◆ MONTHOFYEAR()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR (   $dateValue = 1)
static

MONTHOFYEAR.

Returns the month of a date represented by a serial number. The month is given as an integer, ranging from 1 (January) to 12 (December).

Excel Function: MONTH(dateValue)

1.18.0

DateTimeExcel::month() Use the month method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Returns
int|string Month of the year

Definition at line 756 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts\month().

757  {
758  return DateTimeExcel\DateParts::month($dateValue);
759  }
+ Here is the call graph for this function:

◆ NETWORKDAYS()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS (   $startDate,
  $endDate,
  $dateArgs 
)
static

NETWORKDAYS.

Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.

Excel Function: NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])

1.18.0

DateTimeExcel::count() Use the count method in the DateTimeExcel class instead

Parameters
mixed$startDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
mixed$endDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
mixed$dateArgs
Returns
int|string Interval between the dates

Definition at line 414 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\NetworkDays\count().

415  {
416  return DateTimeExcel\NetworkDays::count($startDate, $endDate, ...$dateArgs);
417  }
static count($startDate, $endDate,... $dateArgs)
NETWORKDAYS.
Definition: NetworkDays.php:29
+ Here is the call graph for this function:

◆ SECOND()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND (   $timeValue = 0)
static

SECOND.

Returns the seconds of a time value. The second is given as an integer in the range 0 (zero) to 59.

Excel Function: SECOND(timeValue)

1.18.0

DateTimeExcel::second() Use the second method in the DateTimeExcel class instead

Parameters
mixed$timeValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string
Returns
int|string Second

Definition at line 852 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeParts\second().

853  {
854  return DateTimeExcel\TimeParts::second($timeValue);
855  }
+ Here is the call graph for this function:

◆ TIME()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME (   $hour = 0,
  $minute = 0,
  $second = 0 
)
static

TIME.

The TIME function returns a value that represents a particular time.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: TIME(hour,minute,second)

1.18.0

DateTimeExcel::fromHMS() Use the fromHMS method in the DateTimeExcel class instead

Parameters
int$hourA number from 0 (zero) to 32767 representing the hour. Any value greater than 23 will be divided by 24 and the remainder will be treated as the hour value. For example, TIME(27,0,0) = TIME(3,0,0) = .125 or 3:00 AM.
int$minuteA number from 0 to 32767 representing the minute. Any value greater than 59 will be converted to hours and minutes. For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.
int$secondA number from 0 to 32767 representing the second. Any value greater than 59 will be converted to hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 195 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Time\fromHMS().

196  {
197  return DateTimeExcel\Time::fromHMS($hour, $minute, $second);
198  }
static fromHMS($hour, $minute, $second)
TIME.
Definition: Time.php:38
+ Here is the call graph for this function:

◆ TIMEVALUE()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE (   $timeValue)
static

TIMEVALUE.

Returns a value that represents a particular time. Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp value.

NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.

Excel Function: TIMEVALUE(timeValue)

1.18.0

DateTimeExcel::fromString() Use the fromString method in the DateTimeExcel class instead

Parameters
string$timeValueA text string that represents a time in any one of the Microsoft Excel time formats; for example, "6:45 PM" and "18:45" text strings within quotation marks that represent time. Date information in time_text is ignored.
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 261 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\TimeValue\fromString().

262  {
263  return DateTimeExcel\TimeValue::fromString($timeValue);
264  }
+ Here is the call graph for this function:

◆ WEEKDAY()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY (   $dateValue = 1,
  $style = 1 
)
static

WEEKDAY.

Returns the day of the week for a specified date. The day is given as an integer ranging from 0 to 7 (dependent on the requested style).

Excel Function: WEEKDAY(dateValue[,style])

1.18.0

DateTimeExcel::day() Use the day method in the DateTimeExcel class instead

Parameters
float | int | string$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$styleA number that determines the type of return value 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). 2 Numbers 1 (Monday) through 7 (Sunday). 3 Numbers 0 (Monday) through 6 (Sunday).
Returns
int|string Day of the week value

Definition at line 497 of file DateTime.php.

References $style, and PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week\day().

498  {
499  return DateTimeExcel\Week::day($dateValue, $style);
500  }
$style
Definition: example_012.php:70
static day($dateValue, $style=1)
WEEKDAY.
Definition: Week.php:131
+ Here is the call graph for this function:

◆ WEEKNUM()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM (   $dateValue = 1,
  $method = self::STARTWEEK_SUNDAY 
)
static

WEEKNUM.

Returns the week of the year for a specified date. The WEEKNUM function considers the week containing January 1 to be the first week of the year. However, there is a European standard that defines the first week as the one with the majority of days (four or more) falling in the new year. This means that for years in which there are three days or less in the first week of January, the WEEKNUM function returns week numbers that are incorrect according to the European standard.

Excel Function: WEEKNUM(dateValue[,style])

1.18.0

DateTimeExcel::number(() Use the number method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$methodWeek begins on Sunday or Monday 1 or omitted Week begins on Sunday. 2 Week begins on Monday. 11 Week begins on Monday. 12 Week begins on Tuesday. 13 Week begins on Wednesday. 14 Week begins on Thursday. 15 Week begins on Friday. 16 Week begins on Saturday. 17 Week begins on Sunday. 21 ISO (Jan. 4 is week 1, begins on Monday).
Returns
int|string Week Number

Definition at line 709 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\Week\number().

710  {
711  return DateTimeExcel\Week::number($dateValue, $method);
712  }
static number($dateValue, $method=Constants::STARTWEEK_SUNDAY)
WEEKNUM.
Definition: Week.php:41
+ Here is the call graph for this function:

◆ WORKDAY()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY (   $startDate,
  $endDays,
  $dateArgs 
)
static

WORKDAY.

Returns the date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed.

Excel Function: WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])

1.18.0

DateTimeExcel::date() Use the date method in the DateTimeExcel class instead

Parameters
mixed$startDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$endDaysThe number of nonweekend and nonholiday days before or after startDate. A positive value for days yields a future date; a negative value yields a past date.
mixed$dateArgs
Returns
mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, depending on the value of the ReturnDateType flag

Definition at line 445 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\WorkDay\date().

446  {
447  return DateTimeExcel\WorkDay::date($startDate, $endDays, ...$dateArgs);
448  }
static date($startDate, $endDays,... $dateArgs)
WORKDAY.
Definition: WorkDay.php:31
+ Here is the call graph for this function:

◆ YEAR()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR (   $dateValue = 1)
static

YEAR.

Returns the year corresponding to a date. The year is returned as an integer in the range 1900-9999.

Excel Function: YEAR(dateValue)

1.18.0

DateTimeExcel::year() Use the ear method in the DateTimeExcel class instead

Parameters
mixed$dateValueExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
Returns
int|string Year

Definition at line 780 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\DateParts\year().

781  {
782  return DateTimeExcel\DateParts::year($dateValue);
783  }
+ Here is the call graph for this function:

◆ YEARFRAC()

static PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC (   $startDate = 0,
  $endDate = 0,
  $method = 0 
)
static

YEARFRAC.

Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations to assign to a specific term.

Excel Function: YEARFRAC(startDate,endDate[,method])

1.18.0

DateTimeExcel::fraction() Use the fraction method in the DateTimeExcel class instead

See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html for description of algorithm used in Excel

Parameters
mixed$startDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
mixed$endDateExcel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string
int$methodMethod used for the calculation 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float|string fraction of the year, or a string containing an error

Definition at line 385 of file DateTime.php.

References PhpOffice\PhpSpreadsheet\Calculation\DateTimeExcel\YearFrac\fraction().

386  {
387  return DateTimeExcel\YearFrac::fraction($startDate, $endDate, $method);
388  }
static fraction($startDate, $endDate, $method=0)
YEARFRAC.
Definition: YearFrac.php:37
+ Here is the call graph for this function:

Field Documentation

◆ DOW_FRIDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_FRIDAY = 6

DOW_FRIDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 635 of file DateTime.php.

◆ DOW_MONDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_MONDAY = 2

DOW_MONDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 599 of file DateTime.php.

◆ DOW_SATURDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_SATURDAY = 7

DOW_SATURDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 644 of file DateTime.php.

◆ DOW_SUNDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_SUNDAY = 1

DOW_SUNDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 590 of file DateTime.php.

◆ DOW_THURSDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_THURSDAY = 5

DOW_THURSDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 626 of file DateTime.php.

◆ DOW_TUESDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_TUESDAY = 3

DOW_TUESDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 608 of file DateTime.php.

◆ DOW_WEDNESDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::DOW_WEDNESDAY = 4

DOW_WEDNESDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 617 of file DateTime.php.

◆ METHODARR

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::METHODARR
Initial value:
= [
self::STARTWEEK_SUNDAY => self::DOW_SUNDAY

METHODARR.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 662 of file DateTime.php.

◆ STARTWEEK_FRIDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_FRIDAY = 15

STARTWEEK_FRIDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 563 of file DateTime.php.

◆ STARTWEEK_MONDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_MONDAY = 2

STARTWEEK_MONDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 518 of file DateTime.php.

◆ STARTWEEK_MONDAY_ALT

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_MONDAY_ALT = 11

STARTWEEK_MONDAY_ALT.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 527 of file DateTime.php.

◆ STARTWEEK_MONDAY_ISO

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_MONDAY_ISO = 21

STARTWEEK_MONDAY_ISO.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 653 of file DateTime.php.

◆ STARTWEEK_SATURDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_SATURDAY = 16

STARTWEEK_SATURDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 572 of file DateTime.php.

◆ STARTWEEK_SUNDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_SUNDAY = 1

STARTWEEK_SUNDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 509 of file DateTime.php.

◆ STARTWEEK_SUNDAY_ALT

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_SUNDAY_ALT = 17

STARTWEEK_SUNDAY_ALT.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 581 of file DateTime.php.

◆ STARTWEEK_THURSDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_THURSDAY = 14

STARTWEEK_THURSDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 554 of file DateTime.php.

◆ STARTWEEK_TUESDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_TUESDAY = 12

STARTWEEK_TUESDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 536 of file DateTime.php.

◆ STARTWEEK_WEDNESDAY

const PhpOffice\PhpSpreadsheet\Calculation\DateTime::STARTWEEK_WEDNESDAY = 13

STARTWEEK_WEDNESDAY.

1.18.0

See also
Use DateTimeExcel instead

Definition at line 545 of file DateTime.php.


The documentation for this class was generated from the following file: