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

x/hex/src/lib/stdx/datetime.ts>toIMF

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
function toIMF
import { toIMF } from "https://deno.land/x/hex@0.6.5/src/lib/stdx/datetime.ts";

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.

Examples

Example 1

import { toIMF } from "https://deno.land/std@0.224.0/datetime/mod.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