首页 > 应用开发 > Java > 小视频源码,使用new Date获取当前时间
小视频源码,使用new Date获取当前时间的相关代码
<template> <div id="home"> 当前时间为:{{gettime}} </div> </template> <script> export default { name: "Home", data() { return { gettime:'', }, methods: { getTime:function(){ var that= this; let yy = new Date().getFullYear(); var mm =new Date().getMonth() < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1; var dd = new Date().getDate() <10 ? "0" + new Date().getDate() : new Date().getDate(); let hh = new Date().getHours(); let mf = new Date().getMinutes()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes(); let ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds(); that.gettime = yy+'-'+mm+'-'+dd+' '+hh+':'+mf+':'+ss; } } } </script> <style scoped> </style>
以上就是
小视频源码,使用new Date获取当前时间的相关代码, 更多内容欢迎关注之后的文章
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/69978258/viewspace-2737536/,如需转载,请注明出处,否则将追究法律责任。