Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

setHours

import { setHours } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Set 4 hours to 1 September 2014 11:30:00:
const result = setHours(new Date(2014, 8, 1, 11, 30), 4)
//=> Mon Sep 01 2014 04:30:00
function setHours<DateType extends Date>(date: DateType | number | string, hours: number): DateType;
§
setHours<DateType extends Date>(date: DateType | number | string, hours: number): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to be changed
§
hours: number
[src]
  • The hours of the new date

§Return Type

§
DateType
[src]

The new date with the hours set