zoukankan      html  css  js  c++  java
  • js日期转换

    1. 转换为:2020-7-9

    var d = new Date()
    
        function date(date) {
            var nowdate = new Date(date).toLocaleDateString().replace(///g, '-')
            return nowdate
        }
        console.log(date(d));

    2. 转换为2020/7/9

    var d = new Date()
    
        function date(date) {
            var nowdate = new Date(date).toLocaleDateString()
            return nowdate
        }
        console.log(date(d));

    3. 转换为2020-07-09 11:30:23

    var d = new Date()
    
        function date(now) {
            // var now = new Date(),
            y = now.getFullYear(),
                m = ("0" + (now.getMonth() + 1)).slice(-2),
                d = ("0" + now.getDate()).slice(-2);
            return y + "-" + m + "-" + d + " " + now.toTimeString().substr(0, 8);
        }
        console.log(date(d));
  • 相关阅读:
    Linux安装nginx
    linux目录结构
    Django-admin
    celery
    Flask-Migrate
    Flask-Script
    Flask-SQLAlchemy
    SQLAlchemy
    mongodb的增删改查
    websocket的加密和解密过程
  • 原文地址:https://www.cnblogs.com/linliu/p/13272695.html
Copyright © 2011-2022 走看看