• Date 日期对象


    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()

  • 相关阅读:
    POJ 2348 Euclid's Game【博弈】
    POJ 2484 A Funny Game【博弈】
    HDU 4193 Non-negative Partial Sums【单调队列】
    占坑补题
    Codeforces 658D Bear and Polynomials【数学】
    Codeforces 658C Bear and Forgotten Tree 3【构造】
    Codeforces 658B Bear and Displayed Friends【set】
    POJ 1704 Georgia and Bob【博弈】
    1001. A+B Format

  • 原文地址:https://www.cnblogs.com/huhuhuhuhuhu/p/10375751.html
Copyright © 2020-2023  润新知