setHours

Modified on Tue, 22 Aug 2023

Description

Use this function to set the hours to the given date.

Syntax

setHours(date, hours)

Returns

Return ValueDescription
DateReturn the resulting date.

Sample

ExampleResultDescription
setHours(2023-3-9, 9.30)Sun Apr 09 2023 14:30:00 GMT-0700 (Pacific Daylight Time)Returns the output as Sun Apr 09 2023 14:30:00 GMT-0700 (Pacific Daylight Time).

To view all the Date functions, click here.

See Also