微信小程序:将yyyy-mm-dd格式的日期转换成yyyy-mm-dd hh:mm:ss格式的日期
2024-09-06 12:12:24
代码如下:
changeDate1(e) {
console.log(e);
var date = new Date(e.detail.value);
console.log(date);
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
var dateString = [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
console.log(dateString);
this.QueryParams.pestDate = dateString
this.setData({
'material.pestDate': e.detail.value
});
},
最新文章
- POJ 1860(spfa)
- all ,any,abs的使用
- 19Mybatis_订单商品数据模型分析
- mysql delete删除记录数据库空间不减少问题解决方法
- C语言调用Lua函数
- 锋利的jQuery第2版学习笔记1~3章
- Mysql一主多从和读写分离配置简记
- Delphi中的GetEnumName和GetEnumValue的使用方法
- IOS 学习笔记 2015-04-15 控制器数据反向传值
- demo_06Canvas
- Sql(in与exists)
- 线下市场,选择微信小程序从未显得如此重要
- SerialPort如何读取串口数据并显示在TextBox上,多线程委托
- ORACLE DB TRIGGER详解
- python 关于操作文件的相关模块(os,sys,shutil,subprocess,configparser)
- markdown自动生成侧边栏TOC /目录
- java抽象类详解
- thumbs.db是什么文件
- linux下zip包处理
- 杂项:TMT(数字媒体产业)