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

std/datetime/mod.ts>toIMF

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function toIMF
Deprecated
Deprecated

(will be removed in 0.209.0) Use date.toUTCString() instead.

Formats the given date to IMF date time format. (Reference: https://tools.ietf.org/html/rfc7231#section-7.1.1.1). IMF is the time format to use when generating times in HTTP headers. The time being formatted must be in UTC for Format to generate the correct format.

import { toIMF } from "https://deno.land/std@0.206.0/datetime/mod.ts";

Examples

Example 1

import { toIMF } from "https://deno.land/std@0.206.0/datetime/to_imf.ts";

toIMF(new Date(0)); // => returns "Thu, 01 Jan 1970 00:00:00 GMT"

Parameters

date: Date

Date to parse

Returns

string

IMF date formatted string