Date and Time Functions in Formulas
- 9 minutes to read
This document describes date and time functions supported by DevExpress Spreadsheet Document API.
Name | Description | Syntax | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the sequential serial number of a particular date. | DATE(year,month,day) Year - A number between one and four digits. If the year is between 0 (zero) and 1899 (inclusive), the function adds this value to 1900 to calculate the year. If the year is between 1900 and 9999 (inclusive), the function uses this value as the year. If the year is less than 0 or is 10000 or greater, the function returns the #NUM! error. Month - A positive or negative integer that specifies the month of the year. If the month is greater than 12, the function adds this number to the first month in the specified year. If the month is less than 1, the function subtracts this value plus 1 from the first month in the specified year. Day - A positive or negative integer that specifies the day of the month. If the day is greater than the number of days in the specified month, the function adds this number of days to the first day in the month. If the day is less than 1, the function subtracts this value plus 1 from the first day in the specified month. | ||||||||||||||||||||||||||||||||||
Returns the number of days, months, or years between two dates. | DATEDIF(start_date, end_date, interval_type) Start_date is the first date of the period. End_date is the last date of the period. You can enter dates as text strings within quotation marks, as serial numbers, or as results of other formulas or functions. Interval_type is a case-insensitive string that specifies the type of information the function returns:
| ||||||||||||||||||||||||||||||||||
Converts a date stored as text to a serial number. | DATEVALUE(date_text) | ||||||||||||||||||||||||||||||||||
Returns the day of a date specified as a serial number. The day is an integer from 1 to 31. | DAY(date_serial_number) Date_serial_number is the serial number of a date. Use functions such as DATE to pass an argument to the DAY function. | ||||||||||||||||||||||||||||||||||
Returns the number of days between two dates. | DAYS(end_date, start_date) | ||||||||||||||||||||||||||||||||||
Returns the number of days between two dates based on a 360-day year (twelve 30-day months). | DAYS360(start_date,end_date,[method]) Start_date and end_date are the two dates between which the function calculates the number of days. Pass dates as cell references or as results of the DATE function or another function that returns the sequential serial number of a date. Method is a logical value that specifies whether the calculation uses the US (NASD) method (False) or the European method (True). If you omit the method argument, the function uses the NASD method. | ||||||||||||||||||||||||||||||||||
Returns a date that is a specified number of months before or after a start date. | EDATE(start_date, months) If months is not an integer, the function truncates the value. Pass dates as cell references or as results of the DATE function or another function that returns the sequential serial number of a date. | ||||||||||||||||||||||||||||||||||
Returns the last day of the month that is a specified number of months before or after a start date. | EOMONTH(start_date, months) If months is not an integer, the function truncates the value. Pass dates as cell references or as results of the DATE function or another function that returns the sequential serial number of a date. | ||||||||||||||||||||||||||||||||||
Returns the hour of a time value. | HOUR(time) Time can be a text string that contains a time, the result of another function (for example, TIMEVALUE), or a decimal number. The decimal number is a portion of a date value (24 hours is 1.0, and 3 AM is 0.125 in decimal time). | ||||||||||||||||||||||||||||||||||
Returns the ISO week number of the year for the specified date. | ISOWEEKNUM(date) | ||||||||||||||||||||||||||||||||||
Returns the minutes of a time value. | MINUTE(time) Time can be a text string that contains a time, the result of another function (for example, TIMEVALUE), or a decimal number. The decimal number is a portion of a date value (24 hours is 1.0, and 3 AM is 0.125 in decimal time). | ||||||||||||||||||||||||||||||||||
Returns the month of a date specified as a serial number. The month is an integer from 1 (January) to 12 (December). | MONTH(date_serial_number) Date_serial_number is the serial number of a date. Use functions such as DATE to pass an argument to the MONTH function. | ||||||||||||||||||||||||||||||||||
Calculates the number of workdays between two dates. | NETWORKDAYS(start_date,end_date,[holidays]) Pass dates as cell references or as results of the DATE function or another function that returns the sequential serial number of a date. The function counts all weekdays and excludes weekends and holidays. To specify holidays to exclude, pass the optional third argument (a range of cells that contain dates or an array of serial numbers of dates). | ||||||||||||||||||||||||||||||||||
Returns the number of whole workdays between two dates. Parameters specify which days and how many days are weekend days. | NETWORKDAYS.INTL(start_date, end_date, weekend, holidays) Start_date and end_date are required parameters that specify the dates between which the function calculates the number of workdays. The weekend parameter is optional and specifies the days of the week that are weekend days. The function does not include weekend days in the number of whole working days. Weekend is a string or one of the following weekend numbers:
A weekend string value contains seven characters. Each character specifies a day of the week, from Monday to Sunday. 1 is a non-workday and 0 is a workday. The string can contain only the characters 1 and 0. For example, 0000110 specifies a weekend that is Friday and Saturday. Holidays is an optional parameter that specifies one or more dates to exclude from working days. Pass a range of cells that contain dates or an array of serial values. | ||||||||||||||||||||||||||||||||||
Returns the current date and time as a serial number. | NOW() | ||||||||||||||||||||||||||||||||||
Returns the seconds of a time value. The second is an integer from 0 to 59. | SECOND(time) Time can be a text string that contains a time, the result of another function (for example, TIMEVALUE), or a decimal number. The decimal number is a portion of a date value (24 hours is 1.0, and 3 AM is 0.125 in decimal time). | ||||||||||||||||||||||||||||||||||
Returns the decimal number for a particular time. | TIME(hour, minute, second) Hour is a number from 0 (zero) to 32767. If the value is greater than 23, the function divides the value by 24 and uses the remainder as the hour value. Minute is a number from 0 (zero) to 32767. If the value is greater than 59, the function converts the value to hours and minutes. Second is a number from 0 (zero) to 32767. If the value is greater than 59, the function converts the value to hours, minutes, and seconds. | ||||||||||||||||||||||||||||||||||
Returns the decimal number of a time stored as a text string. | TIMEVALUE(time_text) The function ignores date information in time_text. The decimal number is a portion of a date value (24 hours is 1.0, and 3 AM is 0.125 in decimal time). | ||||||||||||||||||||||||||||||||||
Returns the serial number of the current date. | TODAY() | ||||||||||||||||||||||||||||||||||
Returns the day of the week that corresponds to a date. The day is an integer from 1 (Sunday) to 7 (Saturday). | WEEKDAY(date_serial_number,[return_type]) Date_serial_number is the serial number of a date. Use functions such as DATE to pass an argument to the WEEKDAY function. Return_type is a number that specifies the integers that the function assigns to weekdays:
| ||||||||||||||||||||||||||||||||||
Returns the week number of a specific date. | WEEKNUM(date_serial_number,[return_type]) Date_serial_number is the serial number of a date. Use functions such as DATE to pass an argument to the WEEKNUM function. Return_type is a number that specifies the numbering system and the first day of the week. The WEEKNUM function supports two numbering systems. System 1 defines the week that contains January 1 as the first week of the year. System 2 defines the week that contains the first Thursday of the year as the first week of the year (ISO 8601, European week numbering system).
| ||||||||||||||||||||||||||||||||||
Returns a date that is a specified number of working days (excluding weekends and holidays) before or after a start date. | WORKDAY(start_date, days, holidays) The function counts all weekdays and excludes weekends and holidays. To specify holidays to exclude, pass the optional third argument (a range of cells that contain dates or an array of serial numbers of dates). | ||||||||||||||||||||||||||||||||||
Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters. | WORKDAY.INTL(start_date, days, weekend, holidays) Start_date is a required parameter that specifies the start date. Days is a required parameter that specifies the number of workdays before or after the start_date. Weekend and holidays are optional parameters. For information about these parameters, refer to the NETWORKDAYS.INTL description. | ||||||||||||||||||||||||||||||||||
Returns the year corresponding to a date. | YEAR(date_serial_number) The function returns the year as an integer from 1900 to 9999. | ||||||||||||||||||||||||||||||||||
Returns the year fraction that corresponds to the number of whole days between start_date and end_date. | YEARFRAC(start_date, end_date, basis) The basis is an optional parameter that specifies the type of day count. Use one of the following basis values:
|