旅游电子商务网站建设,企业网站建设方案策划,骨干校 建设网站,拌合站建站方案Moment.js的简介
Moment.js是一个轻量级的JavaScript时间库#xff0c;以前我们转化时间#xff0c;都会进行很复杂的操作#xff0c;而Moment.js的出现#xff0c;简化了我们开发中对时间的处理#xff0c;提高了开发效率。日常开发中#xff0c;通常会对时间进行下面这…Moment.js的简介
Moment.js是一个轻量级的JavaScript时间库以前我们转化时间都会进行很复杂的操作而Moment.js的出现简化了我们开发中对时间的处理提高了开发效率。日常开发中通常会对时间进行下面这几个操作比如获取时间设置时间格式化时间比较时间等等。
二、在Vue中使用 1. 安装 npm install moment import Moment from /common/moment.js; 获取年 this.year Moment().year() 获取月 this.month Moment().format(MM) 获取这个月的天数 this.daysInatMonth Moment().add(0, month).daysInMonth(); 获取下个月的天数 this.daysInatMonth Moment().add(1, month).daysInMonth(); 初始化日期 Moment().format(YYYY-MM-DD); 格式化日期时间 Moment(value).format(YYYY-MM-DD HH:mm:ss); 先总结这些常用的