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

x/date_fns/index.js>formatISO

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

Examples

// Represent 18 September 2019 in ISO 8601 format (UTC): const result = formatISO(new Date(2019, 8, 18, 19, 0, 52)) //=> '2019-09-18T19:00:52Z'

// Represent 18 September 2019 in ISO 8601, short format (UTC): const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' }) //=> '20190918T190052'

// Represent 18 September 2019 in ISO 8601 format, date only: const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' }) //=> '2019-09-18'

// Represent 18 September 2019 in ISO 8601 format, time only (UTC): const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' }) //=> '19:00:52Z'

Parameters

dirtyDate
  • the original date
dirtyOptions