• 在JS将PHP时间戳,转时间


    //<editor-fold desc="php时间转换 phpstr:要转的时间戳, typ:输出的类型">
    function to_date_time(phpstr, type) {
        // console.log(phpstr);
        str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000
        var newDate = new Date(str);
        var year = newDate.getUTCFullYear();//取年份
        var month = newDate.getUTCMonth() + 1;//取月份
        var nowday = newDate.getUTCDate() + 1;//取天数
        var hours = newDate.getHours();//取小时
        var minutes = newDate.getMinutes();//取分钟
        var seconds = newDate.getSeconds();//取秒
        // console.log(year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds);
        if (type == "1") {
            return year + "." + month + "." + nowday //拼接 2017-2-21
        } else {
            return year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds;//拼接 2017-2-21 12:23:43
        }
    }
    
    //</editor-fold>
  • 相关阅读:
    playbook配置不同系统版本的yum源配置
    使用playbook部署lamp
    ansible常用模块
    部署Ansible
    Ansible介绍与安装
    lamp
    mysql主从
    mysql进阶命令
    mysql基础命令
    Dockerfile制作http镜像(以alpine做底层镜像为例)
  • 原文地址:https://www.cnblogs.com/caitangbutian/p/11696098.html
Copyright © 2020-2023  润新知