How to format a date object?
How to format a date object?
const td = new Date();const result = td.getDate() + "/" + (td.getMonth()) + "/" + td.getFullYear();
Or
const result = new Intl.DateTimeFormat('en-US').format(td);
Or
import moment js
const result = moment().format('YYYY-MM-DD HH:m:s');
Comments