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

x/date_fns/index.js>format

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

Examples

// Represent 11 February 2014 in middle-endian format: var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy') //=> '02/11/2014'

// Represent 2 July 2014 in Esperanto: import { eoLocale } from 'date-fns/locale/eo' var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { locale: eoLocale }) //=> '2-a de julio 2014'

// Escape string by single quote characters: var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") //=> "3 o'clock"

Parameters

dirtyDate
  • the original date
dirtyFormatStr
  • the string of tokens
dirtyOptions