Skip to content

@sqlrooms/utils / formatDateTime

Function: formatDateTime()

formatDateTime(d): string

Formats a date into a human-readable datetime string

Parameters

ParameterTypeDescription
dnumber | bigint | DateDate to format (can be Date object, timestamp number, or bigint)

Returns

string

Formatted string in "Day YYYY-MM-DD HH:MM AM/PM" format

Example

ts
formatDateTime(new Date()); // e.g., "Wed 2024-03-13 02:30 PM"