xxxxxxxxxx
let date = new Date().toJSON();
console.log(date); // 2022-06-17T11:06:50.369Z
xxxxxxxxxx
Pattern Result
---------------- -------
DateFormat.yMd() -> 7/10/1996
DateFormat('yMd') -> 7/10/1996
DateFormat.yMMMMd('en_US') -> July 10, 1996
DateFormat.jm() -> 5:08 PM
DateFormat.yMd().add_jm() -> 7/10/1996 5:08 PM
DateFormat.Hm() -> 17:08 // force 24 hour time
xxxxxxxxxx
date.toISOString() //"2018-07-22T05:22:13.000Z" (ISO 8601 format)
xxxxxxxxxx
const formatDate = date => {
return (
date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
);
};
console.log(formatDate(new Date()));
xxxxxxxxxx
$time = strtotime('10/16/2003');
$newformat = date('Y-m-d',$time);
echo $newformat;
// 2003-10-16
xxxxxxxxxx
date.toString()
// "Sun Jul 22 2018 07:22:13 GMT+0200 (Central European Summer Time)"