tough-cookie.formatdate.md

August 1, 2025 ยท View on GitHub

Home > tough-cookie > formatDate

formatDate() function

Format a Date into the preferred Internet standard format defined in RFC822 and updated in RFC1123.

Signature:

declare function formatDate(date: Date): string;

Parameters

Parameter

Type

Description

date

Date

the date value to format

Returns:

string

Example

formatDate(new Date(0)) === 'Thu, 01 Jan 1970 00:00:00 GMT`

Contents

  1. 1formatDate() function
  2. 2Parameters
  3. 3Example