Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month "d+" : this.getDate(), //day "h+" : this.getHours(), //hour "m+" : this.getMinutes(), //minute "s+" : this.getSeconds(), //second "q+" : Math.floor((this.getMonth()+3)/3), //quarter "S" : this.getMilliseconds() //millisecond } if(/(y+)/i.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); } for(var k in o) { if(new RegExp("("+ k +")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length==1 "00"+ o[k]).substr((""+ o[k]).length)); } } return format; } //使用方法 var now = new Date(); var nowStr = now.format("yyyy-MM-dd hh:mm:ss"); //使用方法2: var testDate = new Date(); var testStr = testDate.format("YYYY年MM月dd日hh小时mm分ss秒"); alert(testStr); //示例: alert(new Date().format("yyyy年MM月dd日")); alert(new Date().format("MM/dd/yyyy")); alert(new Date().format("yyyyMMdd")); alert(new Date().format("yyyy-MM-dd hh:mm:ss"));
代码:
// 格式化formatter中显示的时间格式 // Date.prototype.Format = function(fmt) { // const o = { // 'M+': this.getMonth() + 1, // 月份 // 'd+': this.getDate(), // 日 // 'h+': this.getHours(), // 小时 // 'm+': this.getMinutes(), // 分 // 's+': this.getSeconds(), // 秒 // 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 // 'S': this.getMilliseconds(), // 毫秒 // }; // if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (`${this.getFullYear()}`).substr(4 - RegExp.$1.length)); } // for (const k in o) { // if (new RegExp(`(${k})`).test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) "htmlcode">// new Date(this.envPlanList[i].starttime.slice(0, 4), // this.envPlanList[i].starttime.slice(5, 7), // this.envPlanList[i].starttime.slice(8, 10)), // new Date(this.envPlanList[i].endtime.slice(0, 4), // this.envPlanList[i].endtime.slice(5, 7), // this.envPlanList[i].endtime.slice(8, 10)),2、 年月日 转 2018-10-10
formatter(params) { return `${params.name}: ${new Date(params.value[1]).Format('yyyy/MM/dd')} - - ${new Date(params.value[2]).Format('yyyy/MM/dd')} -- ${params.value[3]}`; // return `${params.name}: ${params.value[1]} -- ${params.value[2]} -- ${params.value[3]}`; },下面看下vue.js时间戳转时间字符串
formartDate(param) { let date = new Date(param); Y = date.getFullYear() + '-'; M = date.getMonth() + 1 < 10 "color: #ff0000">总结以上所述是小编给大家介绍的Vue.js 时间转换代码及时间戳转时间字符串,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年09月26日
2024年09月26日
- 纯音入心系列纯音乐《中央民族乐团-古筝传奇》1CD[MP3][253.1MB]
- 江玲.1989-这样你才爱我,是吗?【新作有声】【WAV+CUE】
- 郭美美.2010-我是郭美美【华纳】【WAV+CUE】
- 黄心懋1991-轻忧郁【滚石】【WAV+CUE】
- 群星.2000-大地金曲世纪回顾2CD【大地】【WAV+CUE】
- 王菲.1996-浮躁(2024环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 群星.2022-传家电视剧原声带【东阳欢娱】【FLAC分轨】
- 《摇滚教父 伍佰黄金精选 2CD》 [WAV+CUE][1GB]
- 《凤凰传奇 我从草原来》[WAV/分轨][400MB]
- 《叶倩文 真心真意过一生》[WAV+CUE][400MB]
- 潘越云.1985-世间女子(滚石25周年经典复刻版)【滚石】【WAV+CUE】
- 陈柏宇.2009-CANT.BE.HALF【SONY】【WAV+CUE】
- 李明依.1989-小女生【滚石】【WAV+CUE】
- 《李荣浩 新时代创作新人王》[WAV分轨][310MB]
- 《黑鸭子与马头琴 史上最动听草原音乐》[WAV+CUE][320MB]