Documentation

DateTime

Tags
deprecated
1.18.0

Table of Contents

DOW_FRIDAY  = 6
DOW_FRIDAY.
DOW_MONDAY  = 2
DOW_MONDAY.
DOW_SATURDAY  = 7
DOW_SATURDAY.
DOW_SUNDAY  = 1
DOW_SUNDAY.
DOW_THURSDAY  = 5
DOW_THURSDAY.
DOW_TUESDAY  = 3
DOW_TUESDAY.
DOW_WEDNESDAY  = 4
DOW_WEDNESDAY.
METHODARR  = [self::STARTWEEK_SUNDAY => self::DOW_SUNDAY, self::DOW_MONDAY, self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY, self::DOW_TUESDAY, self::DOW_WEDNESDAY, self::DOW_THURSDAY, self::DOW_FRIDAY, self::DOW_SATURDAY, self::DOW_SUNDAY, self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO]
METHODARR.
STARTWEEK_FRIDAY  = 15
STARTWEEK_FRIDAY.
STARTWEEK_MONDAY  = 2
STARTWEEK_MONDAY.
STARTWEEK_MONDAY_ALT  = 11
STARTWEEK_MONDAY_ALT.
STARTWEEK_MONDAY_ISO  = 21
STARTWEEK_MONDAY_ISO.
STARTWEEK_SATURDAY  = 16
STARTWEEK_SATURDAY.
STARTWEEK_SUNDAY  = 1
STARTWEEK_SUNDAY.
STARTWEEK_SUNDAY_ALT  = 17
STARTWEEK_SUNDAY_ALT.
STARTWEEK_THURSDAY  = 14
STARTWEEK_THURSDAY.
STARTWEEK_TUESDAY  = 12
STARTWEEK_TUESDAY.
STARTWEEK_WEDNESDAY  = 13
STARTWEEK_WEDNESDAY.
DATE()  : mixed
DATE.
DATEDIF()  : array<string|int, mixed>|int|string
DATEDIF.
DATENOW()  : mixed
DATENOW.
DATETIMENOW()  : mixed
DATETIMENOW.
DATEVALUE()  : mixed
DATEVALUE.
DAYOFMONTH()  : array<string|int, mixed>|int|string
DAYOFMONTH.
DAYS()  : array<string|int, mixed>|int|string
DAYS.
DAYS360()  : array<string|int, mixed>|int|string
DAYS360.
EDATE()  : mixed
EDATE.
EOMONTH()  : mixed
EOMONTH.
getDateValue()  : mixed
getDateValue.
HOUROFDAY()  : array<string|int, mixed>|int|string
HOUROFDAY.
isLeapYear()  : bool
Identify if a year is a leap year or not.
ISOWEEKNUM()  : array<string|int, mixed>|int|string
ISOWEEKNUM.
MINUTE()  : array<string|int, mixed>|int|string
MINUTE.
MONTHOFYEAR()  : array<string|int, mixed>|int|string
MONTHOFYEAR.
NETWORKDAYS()  : array<string|int, mixed>|int|string
NETWORKDAYS.
SECOND()  : array<string|int, mixed>|int|string
SECOND.
TIME()  : mixed
TIME.
TIMEVALUE()  : mixed
TIMEVALUE.
WEEKDAY()  : array<string|int, mixed>|int|string
WEEKDAY.
WEEKNUM()  : array<string|int, mixed>|int|string
WEEKNUM.
WORKDAY()  : mixed
WORKDAY.
YEAR()  : array<string|int, mixed>|int|string
YEAR.
YEARFRAC()  : array<string|int, mixed>|float|string
YEARFRAC.

Constants

DOW_FRIDAY

DOW_FRIDAY.

public mixed DOW_FRIDAY = 6
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_FRIDAY instead

DOW_MONDAY

DOW_MONDAY.

public mixed DOW_MONDAY = 2
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_MONDAY instead

DOW_SATURDAY

DOW_SATURDAY.

public mixed DOW_SATURDAY = 7
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_SATURDAY instead

DOW_SUNDAY

DOW_SUNDAY.

public mixed DOW_SUNDAY = 1
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_SUNDAY instead

DOW_THURSDAY

DOW_THURSDAY.

public mixed DOW_THURSDAY = 5
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_THURSDAY instead

DOW_TUESDAY

DOW_TUESDAY.

public mixed DOW_TUESDAY = 3
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_TUESDAY instead

DOW_WEDNESDAY

DOW_WEDNESDAY.

public mixed DOW_WEDNESDAY = 4
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\DOW_WEDNESDAY instead

METHODARR

METHODARR.

public mixed METHODARR = [self::STARTWEEK_SUNDAY => self::DOW_SUNDAY, self::DOW_MONDAY, self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY, self::DOW_TUESDAY, self::DOW_WEDNESDAY, self::DOW_THURSDAY, self::DOW_FRIDAY, self::DOW_SATURDAY, self::DOW_SUNDAY, self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO]
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\METHODARR instead

STARTWEEK_FRIDAY

STARTWEEK_FRIDAY.

public mixed STARTWEEK_FRIDAY = 15
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_FRIDAY instead

STARTWEEK_MONDAY

STARTWEEK_MONDAY.

public mixed STARTWEEK_MONDAY = 2
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_MONDAY instead

STARTWEEK_MONDAY_ALT

STARTWEEK_MONDAY_ALT.

public mixed STARTWEEK_MONDAY_ALT = 11
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_MONDAY_ALT instead

STARTWEEK_MONDAY_ISO

STARTWEEK_MONDAY_ISO.

public mixed STARTWEEK_MONDAY_ISO = 21
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_MONDAY_ISO instead

STARTWEEK_SATURDAY

STARTWEEK_SATURDAY.

public mixed STARTWEEK_SATURDAY = 16
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_SATURDAY instead

STARTWEEK_SUNDAY

STARTWEEK_SUNDAY.

public mixed STARTWEEK_SUNDAY = 1
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_SUNDAY instead

STARTWEEK_SUNDAY_ALT

STARTWEEK_SUNDAY_ALT.

public mixed STARTWEEK_SUNDAY_ALT = 17
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_SUNDAY_ALT instead

STARTWEEK_THURSDAY

STARTWEEK_THURSDAY.

public mixed STARTWEEK_THURSDAY = 14
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_THURSDAY instead

STARTWEEK_TUESDAY

STARTWEEK_TUESDAY.

public mixed STARTWEEK_TUESDAY = 12
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_TUESDAY instead

STARTWEEK_WEDNESDAY

STARTWEEK_WEDNESDAY.

public mixed STARTWEEK_WEDNESDAY = 13
Tags
Deprecated

1.18.0

see
Use

DateTimeExcel\Constants\STARTWEEK_WEDNESDAY instead

Methods

DATE()

DATE.

public static DATE(int $year[, int $month = 1 ][, int $day = 1 ]) : mixed

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)

Parameters
$year : int

The 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.

$month : int = 1

A 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.

$day : int = 1

A 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.

Tags
Deprecated

1.18.0

See

DateTimeExcel\Date::fromYMD() Use the fromYMD method in the DateTimeExcel\Date 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.

Return values
mixed

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

DATEDIF()

DATEDIF.

public static DATEDIF(mixed $startDate, mixed $endDate[, array<string|int, mixed>|string $unit = 'D' ]) : array<string|int, mixed>|int|string

Excel Function: DATEDIF(startdate, enddate, unit)

Parameters
$startDate : mixed

Excel date serial value, PHP date/time stamp, PHP DateTime object or a standard date string

$endDate : mixed

Excel date serial value, PHP date/time stamp, PHP DateTime object or a standard date string

$unit : array<string|int, mixed>|string = 'D'
Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Interval between the dates

DATENOW()

DATENOW.

public static DATENOW() : mixed

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()

Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

DATETIMENOW()

DATETIMENOW.

public static DATETIMENOW() : mixed

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()

Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

DATEVALUE()

DATEVALUE.

public static DATEVALUE(string $dateValue) : mixed

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)

Parameters
$dateValue : string

Text 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.

Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

DAYOFMONTH()

DAYOFMONTH.

public static DAYOFMONTH([mixed $dateValue = 1 ]) : array<string|int, mixed>|int|string

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)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Day of the month

DAYS()

DAYS.

public static DAYS(array<string|int, mixed>|DateTimeInterface|float|int|string $endDate, array<string|int, mixed>|DateTimeInterface|float|int|string $startDate) : array<string|int, mixed>|int|string

Returns the number of days between two dates

Excel Function: DAYS(endDate, startDate)

Parameters
$endDate : array<string|int, mixed>|DateTimeInterface|float|int|string

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$startDate : array<string|int, mixed>|DateTimeInterface|float|int|string

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Number of days between start date and end date or an error

DAYS360()

DAYS360.

public static DAYS360(mixed $startDate, mixed $endDate[, array<string|int, mixed>|bool $method = false ]) : array<string|int, mixed>|int|string

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])

Parameters
$startDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$endDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$method : array<string|int, mixed>|bool = false

US 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.

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Number of days between start date and end date

EDATE()

EDATE.

public static EDATE([mixed $dateValue = 1 ], int $adjustmentMonths) : mixed

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)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$adjustmentMonths : int

The number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.

Tags
Deprecated

1.18.0

See

DateTimeExcel\Month::adjust() Use the adjust method in the DateTimeExcel\Edate class instead

Return values
mixed

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

EOMONTH()

EOMONTH.

public static EOMONTH([mixed $dateValue = 1 ], int $adjustmentMonths) : mixed

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)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$adjustmentMonths : int

The number of months before or after start_date. A positive value for months yields a future date; a negative value yields a past date.

Tags
Deprecated

1.18.0

See

DateTimeExcel\Month::lastDay() Use the lastDay method in the DateTimeExcel\EoMonth class instead

Return values
mixed

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

getDateValue()

getDateValue.

public static getDateValue(mixed $dateValue) : mixed
Parameters
$dateValue : mixed
Tags
Deprecated

1.18.0

See

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

Return values
mixed

Excel date/time serial value, or string if error

HOUROFDAY()

HOUROFDAY.

public static HOUROFDAY(mixed $timeValue) : array<string|int, mixed>|int|string

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)

Parameters
$timeValue : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Hour

isLeapYear()

Identify if a year is a leap year or not.

public static isLeapYear(int|string $year) : bool
Parameters
$year : int|string

The year to test

Tags
Deprecated

1.18.0

See

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

Return values
bool

TRUE if the year is a leap year, otherwise FALSE

ISOWEEKNUM()

ISOWEEKNUM.

public static ISOWEEKNUM([mixed $dateValue = 1 ]) : array<string|int, mixed>|int|string

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

Excel Function: ISOWEEKNUM(dateValue)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Week Number

MINUTE()

MINUTE.

public static MINUTE(mixed $timeValue) : array<string|int, mixed>|int|string

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

Excel Function: MINUTE(timeValue)

Parameters
$timeValue : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Minute

MONTHOFYEAR()

MONTHOFYEAR.

public static MONTHOFYEAR([mixed $dateValue = 1 ]) : array<string|int, mixed>|int|string

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)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Month of the year

NETWORKDAYS()

NETWORKDAYS.

public static NETWORKDAYS(mixed $startDate, mixed $endDate, mixed ...$dateArgs) : array<string|int, mixed>|int|string

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[,...]]])

Parameters
$startDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$endDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$dateArgs : mixed
Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Interval between the dates

SECOND()

SECOND.

public static SECOND(mixed $timeValue) : array<string|int, mixed>|int|string

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)

Parameters
$timeValue : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard time string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Second

TIME()

TIME.

public static TIME(int $hour, int $minute, int $second) : mixed

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)

Parameters
$hour : int

A 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.

$minute : int

A 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.

$second : int

A 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

Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

TIMEVALUE()

TIMEVALUE.

public static TIMEVALUE(string $timeValue) : mixed

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)

Parameters
$timeValue : string

A 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.

Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

WEEKDAY()

WEEKDAY.

public static WEEKDAY([float|int|string $dateValue = 1 ][, int $style = 1 ]) : array<string|int, mixed>|int|string

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])

Parameters
$dateValue : float|int|string = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$style : int = 1

A 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).

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Day of the week value

WEEKNUM()

WEEKNUM.

public static WEEKNUM([mixed $dateValue = 1 ][, int $method = self::STARTWEEK_SUNDAY ]) : array<string|int, mixed>|int|string

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])

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$method : int = self::STARTWEEK_SUNDAY

Week 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).

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Week Number

WORKDAY()

WORKDAY.

public static WORKDAY(mixed $startDate, int $endDays, mixed ...$dateArgs) : mixed

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[,...]]])

Parameters
$startDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$endDays : int

The 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.

$dateArgs : mixed
Tags
Deprecated

1.18.0

See

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

Return values
mixed

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

YEAR()

YEAR.

public static YEAR([mixed $dateValue = 1 ]) : array<string|int, mixed>|int|string

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

Excel Function: YEAR(dateValue)

Parameters
$dateValue : mixed = 1

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

Tags
Deprecated

1.18.0

See

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

Return values
array<string|int, mixed>|int|string

Year

YEARFRAC()

YEARFRAC.

public static YEARFRAC(mixed $startDate, mixed $endDate, array<string|int, mixed>|int $method) : array<string|int, mixed>|float|string

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])

Parameters
$startDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$endDate : mixed

Excel date serial value (float), PHP date timestamp (integer), PHP DateTime object, or a standard date string

$method : array<string|int, mixed>|int

Method used for the calculation 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360

Tags
Deprecated

1.18.0

See

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

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

Return values
array<string|int, mixed>|float|string

fraction of the year, or a string containing an error

Search results