Przejdź do głównej zawartości

Function: formatDateTime()

formatDateTime(date, locale): string

Format a date with time in the requested locale (month-abbreviated date plus hour and minute, 12- or 24-hour depending on locale convention).

Parameters​

date​

string | Date

locale​

string

Returns​

string

Example​

formatDateTime(new Date(), 'en-US')  // => "Dec 9, 2025, 10:30 PM"
formatDateTime(new Date(), 'pl-PL') // => "9 gru 2025, 22:30"