首页 > 其他 > 详细

时间戳格式化

时间:2018-03-23 16:02:11      阅读:400      评论:0      收藏:0      [点我收藏+]

按照YYYY-MM-DD HH:mm:ss格式化时间

<template>
  <div></div>
</template>
<script>
export default{
  created() {
    this._getDate()
  },
  methods: {
    _getDate() {
      let now = new Date()
      console.log(now, now)
      let year = now.getFullYear()
      let month = now.getMonth() + 1
      let day = now.getDate()
      let hour = now.getHours()
      let minutes = now.getMinutes()
      let seconds = now.getSeconds()
      let time = year + - + month + - + day +   + hour + : + minutes + : + seconds
      console.log(time)
    }
  }
}
</script>

技术分享图片

时间戳格式化

原文:https://www.cnblogs.com/beka/p/8617464.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!