es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
11 lines (10 loc) • 457 B
TypeScript
/**
* Formats the date according to the specified format string.
* @param {Date} date - The date to format.
* @param {string} formatStr - The format string (e.g., 'YYYY-MM-DD hh:mm:ss').
* @returns {string} The formatted date string.
* @example
* const date = new Date('2023-05-01T12:30:45');
* const formatted = format(date, 'YYYY-MM-DD hh:mm:ss'); // '2023-05-01 12:30:45'
*/
export declare function format(date: Date, formatStr: string): string;