startOfDecade

Modified on Tue, 22 Aug 2023

Description

Use this function to obtain the start date of the decade for a given date. It returns the date that marks the beginning of the decade in which the input date falls.

Syntax

startOfDecade(date)

Returns

Return ValueDescription
DateReturns a Date object representing the start of the decade for the given date.

Sample

ExampleResultDescription
startOfDecade(2023-06-15)2020-01-01The function returns the start of the decade for June 15, 2023, which is January 1, 2020.
startOfDecade(1990-12-31)1990-01-01The function returns the start of the decade for December 31, 1990, which is January 1, 1990.
startOfDecade(1975-09-05)1970-01-01The function returns the start of the decade for September 5, 1975, which is January 1, 1970.

To view all the Date functions, click here.

See Also