Function: formatDate()
formatDate(
date,formatter?,utc?):string
Formats a Date object according to the specified formatter string.
Parameters
date
Date
The Date object to format
formatter?
string = 'YYYY-MM-DD hh:mm:ss'
The format string. Supports YYYY (year), MM (month), DD (day), hh (hours), mm (minutes), ss (seconds)
utc?
boolean = false
Whether to use UTC time instead of local time
Returns
string
The formatted date string
