zoukankan      html  css  js  c++  java
  • 日期的格式化年月日星期

          var date = new Date(),
                year = date.getFullYear(),
                month = date.getMonth() + 1,
                day = date.getDate(),
                week = date.getDay(),
                str = '',
                hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
                minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
                second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                month >= 1 && month <= 9 ? (month = "0" + month) : "";
                day >= 0 && day <= 9 ? (day = "0" + day) : "";
                if (week == 0) {  
                        str = "周日";  
                } else if (week == 1) {  
                        str = "周一";  
                } else if (week == 2) {  
                        str = "周二";  
                } else if (week == 3) {  
                        str = "周三";  
                } else if (week == 4) {  
                        str = "周四";  
                } else if (week == 5) {  
                        str = "周五";  
                } else if (week == 6) {  
                        str = "周六";  
                }  
  • 相关阅读:
    24.Azkaban调度脚本的编写
    Docker 安装 Apache
    Docker 安装 MongoDB
    Docker 安装 Redis
    Docker 安装 Python
    Docker 安装 Tomcat
    Docker 安装 MySQL
    Docker 安装 PHP
    Docker 安装 Nginx
    Docker 镜像使用
  • 原文地址:https://www.cnblogs.com/xiaoxie2016/p/12612048.html
Copyright © 2011-2022 走看看