美文网首页
时间戳转为年月日时分秒格式的时间

时间戳转为年月日时分秒格式的时间

作者: 魔主恋上九尾狐 | 来源:发表于2020-07-28 09:24 被阅读0次

stringToDate(item) {

                let time="";

              let dateStr='1595661942000';

                //let dateStr=item.createTime;

                //let data=new Date();

                let date = new Date(dateStr);

                let y = date.getFullYear();

                let MM = date.getMonth() + 1;

                MM = MM < 10 ? ('0' + MM) : MM;

                let d = date.getDate();

                d = d < 10 ? ('0' + d) : d;

                let h = date.getHours();

                h = h < 10 ? ('0' + h) : h;

                let m = date.getMinutes();

                m = m < 10 ? ('0' + m) : m;

                let s = date.getSeconds();

                s = s < 10 ? ('0' + s) : s;

                time=y + '年' + MM + '月' + d + '日' + ' ' + h + ':' + m + ':' + s;

                item.time=time;

                return item;

            }

相关文章

  • jquery将时间戳转为精确到秒的时间

    时间戳 转为年月日 时分秒 时间转为时间戳,或时间戳转为时间

  • datetime:时间戳转换

    将时间戳转换为年月日时分秒格式: 将年月日时分秒格式转换为时间戳:

  • 4.时间的处理,monent插件

    1.格式化时间 2.格式化年月日时分秒 3.通过获取当前时间的时间戳转化为年月日时分秒 4.某个时间时间戳转换成日...

  • 安卓之项目实战经验总结(2)

    1、时间戳转换问题我们在开发的时候,我们会把服务器返回的时间戳转为年月日时分秒等格式,但是在转换的时间会发现时间和...

  • HIVE中的from_unixtime函数

    hive中的from_unixtime()函数,可以把时间戳格式的时间,转化为年月日时分秒格式的时间。 from_...

  • 格式化时间方法

    /** *时间戳转化为年月日时分秒 *number:传入时间戳 *format:返回格式,支持自定义,但参数必须...

  • js 时间格式化

    dateTime=====>要格式化的数据(包括:时间戳,年月日时分秒...) fmt===>要格式化的格式(y:...

  • 时间戳转为年月日时分秒格式的时间

    stringToDate(item) { let time=""; let date...

  • UTC时间与时区时间转换

    描述 时间日期与time stamp转换 参考 C语言实现将时间戳转换为年月日时分秒和将年月日时分秒转换为时间戳 ...

  • day19时间模块

    时间模块 主要包含处理年月日时分秒对应的时间(着重时分秒) 专门处理年月日 1.获取当前时间 时间戳:就是从格林威...

网友评论

      本文标题:时间戳转为年月日时分秒格式的时间

      本文链接:https://www.haomeiwen.com/subject/azixrktx.html