Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/date_fns/index.js>subHours

date-fns Deno package
Very Popular
Go to Latest
function subHours
import { subHours } from "https://deno.land/x/date_fns@v2.12.0/index.js";

Examples

// Subtract 2 hours from 11 July 2014 01:00:00: var result = subHours(new Date(2014, 6, 11, 1, 0), 2) //=> Thu Jul 10 2014 23:00:00

Parameters

dirtyDate
  • the date to be changed
dirtyAmount
  • the amount of hours to be subtracted. Positive decimals will be rounded using Math.floor, decimals less than zero will be rounded using Math.ceil.