Acquisition date format yyyy-md simple wording

Method: () functions acquired by the date toLocaleString. new Date () toLocaleString ();. // "2019/9/1 11:20:23 AM"

. Method acquisition date: new Date () toLocaleString () .replace (/ \ // g, '-') split ( "") [0]; // "2019-9-1"

toLocaleString () method to convert the local time according to the Date object as a string, and returns the result.

Guess you like

Origin www.cnblogs.com/xingqitian/p/11441780.html