• Date : 日期对象


     一、如何创建日期对象
                    1. new Date()
                    2. new Date(year,month,date,hours,minutes,seconds)
                    3. new Date(year,month,date)
                二、如何获取日期时间?
                    1. 获取年份
                    date.getFullYear()
                    2. 获取月份
                    date.getMonth()
                    3. 获取日
                    date.getDate()
                    4. 获取星期
                    date.getDay()
                    5. 获取小时
                    date.getHours()
                    6. 获取分钟
                    date.getMinutes()
                    7. 获取秒钟
                    date.getSeconds()
                    8. 获取毫秒
                    date.getMilliseconds()
                    9. 获取时间戳
                    date.getTime()
                三、时间戳 : 从1970年1月1日0时整到现在的毫秒数。
                四、以本地格式的字符串显示日期时间
                    date.toLocaleString()
                    以本地格式的字符串显示日期
                    date.toLocaleDateString()
                    以本地格式的字符串显示时间
                    date.toLocaleTimeString()
                扩展五、设置日期时间
                    1. 设置年份
                    date.setFullYear()
                    2. 设置月份
                    date.setMonth()
                    3. 设置日
                    date.setDate()
                    4. 小时
                    date.setHours()
                    5. 分钟
                    date.setMinutes()
                    6. 秒钟
                    date.setSeconds()
                    7. 毫秒
                    date.setMilliSeconds()

     

  • 相关阅读:
    搭建docker私有registory (harbor)
    消息队列原理及ActiveMQ、RocketMQ、RabbitMQ、Kafka区别总结
    too many users are authenticated
    docker环境部署nginx、tomcat、redis
    docekr环境部署mysql、kafaka、kafkamanager和mongodb
    在IE6 情况下让PNG图片透明的3种方法
    ecshop商品列表页出现一个空的搜索结果
    ecshop去掉国家省市区,实现手动填写收货地址
    ecshop始终显示全部分类
    ecshop商品列表页增加/显示货号SN
  • 原文地址:https://www.cnblogs.com/pppoe/p/10388935.html
Copyright © 2020-2023  润新知