clean-jsdoc-theme TypeDoc APIv0.0.0

formatTime

formatTime( date: string | number | Date, format: 'short' | 'medium' | 'long', options: DateFormatOptions, ): string

Source: date.ts:101

Formats a time using Intl.DateTimeFormat

Parameters

  • date (string | number | Date) — Date to format
  • format ("short" | "medium" | "long", default: "'short'") — Format style
  • options (DateFormatOptions, default: "{}") — Additional options

Returns

  • string — Formatted time string

Example

CODE
formatTime(new Date(), 'short') // '2:30 PM'
formatTime(new Date(), 'medium') // '2:30:45 PM'
formatTime(new Date(), 'long') // '2:30:45 PM EST'