本文共 477 字,大约阅读时间需要 1 分钟。
// 系统当前时间格式化moment().format('MMMM Do YYYY, h:mm:ss a'); // 四月 21日 2021, 9:00:54 晚上moment().format('dddd'); // 星期三moment().format("MMM Do YY"); // 4月 21日 21moment().format('YYYY [escaped] YYYY'); // 2021 escaped 2021moment().format(); // 2021-04-21T21:00:54+08:00//指定日期格式化moment(time).format('ddd MMMDo') // time 对应的是毫秒数
默认日期语言是英文,如果想要日期显示的是中文,需要在moment().format()日期格式化之前,设置日期显示语言
moment.locale('zh-cn')
转载地址:http://yqyrf.baihongyu.com/