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

addHours

import { addHours } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Add 2 hours to 10 July 2014 23:00:00:
const result = addHours(new Date(2014, 6, 10, 23, 0), 2)
//=> Fri Jul 11 2014 01:00:00
function addHours<DateType extends Date>(date: DateType | number | string, amount: number): DateType;
§
addHours<DateType extends Date>(date: DateType | number | string, amount: number): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to be changed
§
amount: number
[src]
  • The amount of hours to be added.

§Return Type

§
DateType
[src]

The new date with the hours added