The Date object to format
The format string. Supports YYYY (year), MM (month), DD (day), hh (hours), mm (minutes), ss (seconds)
Whether to use UTC time instead of local time
The formatted date string
const date = new Date(2024, 0, 1, 12, 30, 45);
formatDate(date, 'YYYY-MM-DD hh:mm:ss'); // Returns "2024-01-01 12:30:45"
formatDate(date, 'DD/MM/YYYY', true); // Returns "01/01/2024" in UTC
Formats a Date object according to the specified formatter string.