当前位置:网站首页>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;}},
边栏推荐
猜你喜欢
随机推荐
ABP中的数据过滤器
07 Spark on RDD 血缘关系
2022牛客多校六 M-Z-Game on grid(动态规划)
风控建模二:建模方案拟定
(2022牛客多校四)K-NIO‘s Sword(思维)
[PP-YOLOv2] Training a custom dataset
【深度学习】TensorFlow学习之路二:ANN简介及TensorFlow实现
2022杭电多校六 1006-Maex (树形DP)
51nod 1830
Binary tree level traversal and examples
Use Mongoose populate to implement multi-table associative storage and query, with complete code included
(2022牛客多校四)H-Wall Builder II(思维)
Master-slave delay reason and solution
弹出PopupWindow后让背景变暗的方法
[Tensorflow2] Some interface changes of tensorflow1.x-tensorflow2.x
Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
神经网络学习笔记(1)
2021 RoboCom 世界机器人开发者大赛-本科组(决赛)7-4猛犸不上 Ban(最短路)
MySQL 原理与优化,Group By 优化 技巧
可以在易方达基金上买基金吗,安全吗