赞
踩
- let timestamp = Date.parse(new Date());
- let date = new Date(timestamp);
- //获取年份
- let thisYear = date.getFullYear();
- let timestamp = Date.parse(new Date());
- let date = new Date(timestamp);
-
- // 获取月份
- let thisMonth = date.getMonth() + 1; // 返回值为1-12之间的整数
-
- // 将月份值转换为带有前导零的文本形式
- let formattedMonth = thisMonth.toString().padStart(2, '0');
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。