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

differenceInSeconds

import { differenceInSeconds } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// How many seconds are between
// 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
const result = differenceInSeconds(
  new Date(2014, 6, 2, 12, 30, 20, 0),
  new Date(2014, 6, 2, 12, 30, 7, 999)
)
//=> 12
function differenceInSeconds<DateType extends Date>(
dateLeft: DateType | number | string,
dateRight: DateType | number | string,
): number;
§
differenceInSeconds<DateType extends Date>(dateLeft: DateType | number | string, dateRight: DateType | number | string, options?: DifferenceInSecondsOptions): number
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
dateLeft: DateType | number | string
[src]
  • The later date
§
dateRight: DateType | number | string
[src]
  • The earlier date
§
  • An object with options.

§Return Type

§
number
[src]

The number of seconds