当前位置:网站首页>Formatting of time objects
Formatting of time objects
2022-08-08 23:36:00 【Satoshi seeds】
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;}},
边栏推荐
猜你喜欢
随机推荐
makefile automatically compiles C files in directories and subdirectories
LightningChart .NET 10.3.2 Crack 支持旧项目直接升级
C语言中指针的介绍
stm32 uses serial port to receive idle interrupt + dma to achieve variable length dma reception
10 Spark on RDD Cache
使用Mongoose populate实现多表关联存储与查询,内附完整代码
(2022杭电多校四)1001-Link with Bracket Sequence II(区间动态规划)
WeChat applet develops some function usage methods
时间对象的格式化
Small program figure display banner
(2022杭电多校三)1002-Boss Rush(状压DP+二分)
51nod1656 合并trie树
2022杭电多校六 1006-Maex (树形DP)
如何在Android中使用Realm数据库
容斥原理
php 将时间戳转化为 刚刚、几分钟前、几小时前、几天前 格式
redis集群三主三从redis-cli
08 Spark on RDD 依赖关系
PHP regular to img SRC to add the domain name
风控建模一:好坏标签定义