Excel Date/Time Functions


Extraction Functions

To extract the parts of a date/time, use one of the YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND functions.


Construction Functions

DATE

Construct a date value.

A common pattern to guard against over-specified dates is to extract the necessary components from a date/time and construct the minimal value.

=DATE(YEAR(B4), MONTH(B4), DAY(B4))

This would convert 1/1/2020 12:30:00 PM (which cannot be logically compared to a date) into 1/1/2020 (which can).

TIME

Construct a time value.

=TIME(HOUR(B4), MINUTE(B4), SECOND(B4))

DATEVALUE and TIMEVALUE

Excel tries to convert strings that look like dates/times when they are entered. This functionality is exposed in the DATEVALUE and TIMEVALUE functions.

TODAY, NOW

TODAY exposes the current system date and NOW exposes the current system datetime.


Date Difference Functions

DATEDIF

DAYS


CategoryRicottone

Excel/DateTimeFunctions (last edited 2022-03-09 15:44:04 by DominicRicottone)