Date and time functions

To format a spreadsheet column for date, time or date-time input, see How to enter dates.

DATEVALUE String to serial date number

The function DATEVALUE(str) returns the serial date number for the date expressed in the string str.

DATEVALUE("10.12.88") returns 68645 if the date format is DD.MM.YY.

DATE Serial date number to string

DATE(dnr) returns the date corresponding with the serial date number dnr expressed as a string.

DATE(DATEVALUE(A1)+7) returns "6.9.96" when cell A1 contains the date string 30.8.96 or "30/8/96" (date format DD.MM.YY)

DATEFRAC Fractional year-number

DATEFRAC(date) converts date into a fractional year-number. The integer part of this number is the year, and the decimal fraction ranges from 0.0 to 0.99..., representing the dates 01 Jan to 31 Dec.

DATEFRAC("01.07.2000") returns 2000.5

DAY Day function

DAY(date) returns the day of the month of date. Date can either be a serial date number or a date string.

DAY("23.08.88") returns 23 (date format DD.MM.YY)

DAYNAME Day name function

DAYNAME(date) returns the name of the day of date. Date can either be a serial date number or a date string.

DAYNAME("03.12.2001") returns "Monday" (date format DD.MM.YY)

MONTH Month function

MONTH(date) returns the month of the year of date. Date can either be a serial date number or a date string.

MONTH("23.08.88") returns 8 (date format DD.MM.YY)

MONTHNAME Month name function

MONTHNAME(date) returns the name of the month of date. Date can either be a serial date number or a date string.

MONTHNAME("03.12.2001") returns "December" (date format DD.MM.YY)

TIMEVALUE String to serial time number

TIMEVALUE(str) converts a time string (in "hh:mm" format) to a serial time number. A serial time number is a number ranging from 0.00 to 1.00 representing the time 0:00 to 24:00.

TIMEVALUE("06:30") returns 0.27084
TIMEVALUE("12:00") returns 0.5

TIME Serial time number to string

TIME(tnr) converts the serial time number tnr to a time string (hh:mm).

TIME(0.5) returns 12:00

TIMEFRAC Fractional time-number

TIMEFRAC(time) converts time into a fractional time-number. The integer part of this number is the hour, and the decimal fraction ranges from 0.0 to 0.99, representing the minutes 0:00 to 0:59.

TIMEFRAC("12:30") returns 12.5

TODAY Today's date

The function TODAY() takes no argument and returns today's date. Note that the value of this function is not fixed, so if you use this function in a file and you reload this file the next day, the function will return the new date.

TODAY() returns 24.01.1998 if today is the 24th of January 1998 and the date format is DD.MM.YY.

DATEVAL(TODAY()) returns the serial number of today's date.

WEEKNUM Week number function

WEEKNUM(date) returns the number of the week of the year of date. Date can either be a serial date number or a date string.

WEEKNUM("01.01.98") returns 1
WEEKNUM("05.02.98") returns 2
WEEKNUM("25.12.98") returns 52

WEEKDAY Weekday number function

WEEKDAY(date) returns the weekday number of date. Days are numbered from Monday (=1) to Sunday (=7).

WEEKDAY("05.07.56") returns 4, this is the 4th day of the week (=Thursday).

YEAR Year function

YEAR(date) returns the year of date. Date can either be a serial date number or a date string.

YEAR("23.08.88") returns 88 (date format DD.MM.YY)
YEAR(TODAY()) returns today's year.

See also

Privacy Contact Site map