当前位置:网站首页>Formatting of time objects
Formatting of time objects
2022-08-08 23:36:00 【Chung seed】
value timestamp
format format 'mm' to hour 'ss' to second, if not filled in, the default returns to day
connector If not filled in, the default is '-'
{string}
timeFormat: function (value, format, connector) {var date = new Date(value);var yy = date.getFullYear();var MM = date.getMonth() + 1;var dd = date.getDate();var hh = date.getHours();var mm = date.getMinutes();var ss = date.getSeconds();var link = '-';connector ? link = connector : link = '-';if (MM < 10)MM = "0" + MM;if (dd < 10)dd = "0" + dd;if (hh < 10)hh = "0" + hh;if (mm < 10)mm = "0" + mm;if (ss < 10)ss = "0" + ss;if (format === 'mm') {return "" + yy + link + MM + link + dd + " " + hh + ":" + mm;} else if (format === 'ss') {return "" + yy + link + MM + link + dd + " " + hh + ":" + mm + ":" + ss;} else {return "" + yy + link + MM + link + dd;}},边栏推荐
- redis集群redis-trib扩容缩容
- grpc系列3-自定义端镜像GOAWAY with error code ENHANCE_YOUR_CALM and debug data equal to “too_many_pings“
- 最常用正则表达式
- (2022牛客多校五)C-Bit Transmission(思维)
- 读书笔记怎么写?
- Hi3516 使用 wifi模块
- 【深度学习】TensorFlow学习之路二:ANN简介及TensorFlow实现
- (2022杭电多校四)1011-Link is as bear(思维+线性基)
- Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
- 如何在Android中使用Realm数据库
猜你喜欢
随机推荐
Qt入门(五)——文件操作、热键和鼠标的读取(txt窗口的实现)
grpc系列3-自定义端镜像GOAWAY with error code ENHANCE_YOUR_CALM and debug data equal to “too_many_pings“
容斥原理
09 Spark on RDD 阶段划分
Golang gorm 数据库连接,迁移,索引
mysql 高级知识【order by 排序优化】
线性筛求积性函数
(2022牛客多校五)B-Watches(二分)
(2022牛客多校三)J-Journey(dijkstra)
07 Spark on RDD 血缘关系
最常用正则表达式
跨域请求浏览器无法显示set-cookie,坑了我一晚上
(2022杭电多校五)1010-Bragging Dice (思维)
Hi3516 使用 wifi模块
php convert timestamp to just, minutes ago, hours ago, days ago format
根據百度地图返回的地址,截取省,市,区
北斗网络同步时钟与GPS卫星时钟同步设备的区别
树莓派wiringPi库的使用补充
【CUDA】version switch freely
ABP中的数据过滤器









