Optional
format: "date" | "time" | "date-time"A string representation of the date in the specified format.
// returns '2023-11-09'
convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date');
// returns '14:22:54'
convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'time');
// returns '2023-11-09T14:22:54.131Z'
convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date-time');
// returns '2023-11-09T14:22:54.131Z'
convertDateToString(new Date('2023-11-09T14:22:54.131Z'));
Returns the string representation of the given date. The format of the output string can be specified: