ExcelDate&TimeFunctions
ExcelDate&TimeFunctions
2. `TODAY()`
- Description: Returns the current date.
- Example: `=TODAY()` returns today’s date.
3. `NOW()`
- Description: Returns the current date and time.
- Example: `=NOW()` returns the current date and time.
4. `YEAR(date)`
- Description: Extracts the year from a date.
- Example: `=YEAR(DATE(2024, 8, 13))` returns 2024.
5. `MONTH(date)`
- Description: Extracts the month from a date.
- Example: `=MONTH(DATE(2024, 8, 13))` returns 8.
6. `DAY(date)`
- Description: Extracts the day of the month from a date.
- Example: `=DAY(DATE(2024, 8, 13))` returns 13.
7. `WEEKDAY(date, [return_type])`
- Description: Returns the day of the week as a number (1-7).
- Example: `=WEEKDAY(DATE(2024, 8, 13), 1)` returns 2 (Tuesday).
- Return Types:
- 1: Numbers 1 (Sunday) to 7 (Saturday).
- 2: Numbers 1 (Monday) to 7 (Sunday).
- 3: Numbers 0 (Monday) to 6 (Sunday).
8. `WEEKNUM(date, [return_type])`
- Description: Returns the week number of a date.
- Example: `=WEEKNUM(DATE(2024, 8, 13), 1)` returns 33.
12. `DATEVALUE(date_text)`
- Description: Converts a date in text format to a serial number.
- Example: `=DATEVALUE("2024-08-13")` returns the serial number
corresponding to August 13, 2024.
Time Functions
2. `HOUR(time)`
- Description: Extracts the hour from a time value.
- Example: `=HOUR(TIME(14, 30, 0))` returns 14.
3. `MINUTE(time)`
- Description: Extracts the minute from a time value.
- Example: `=MINUTE(TIME(14, 30, 0))` returns 30.
4. `SECOND(time)`
- Description: Extracts the second from a time value.
- Example: `=SECOND(TIME(14, 30, 15))` returns 15.
5. `TIMEVALUE(time_text)`
- Description: Converts a time in text format to a serial number.
- Example: `=TIMEVALUE("14:30:00")` returns the serial number
corresponding to 2:30 PM.
Date and Time Calculations
Additional Functions
1. `TEXT(value, format_text)`
- Description: Converts a value to text in a specified number format.
- Example: `=TEXT(DATE(2024, 8, 13), "dddd, mmmm d, yyyy")` returns
"Tuesday, August 13, 2024".