JS实现时间日期格式化 依赖:无 1. [代码] [JavaScript]代码 var intl=new Intl.DateTimeFormat("zh-CN",{weekday:"long", year: "numeric", month: "short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:false}
依赖:无
1. [代码][JavaScript]代码
var intl=new Intl.DateTimeFormat("zh-CN", {weekday:"long", year: "numeric", month: "short", day:"numeric", hour:"numeric", minute:"numeric", second:"numeric", hour12:false}); var date=new Date(); var text=intl.format(date).split(" "); console.log(date);//Wed Aug 17 2016 17:12:49 GMT+0800 (中国标准时间) console.log(text);//["2016年8月17日星期三", "17:12:49"]