zoukankan      html  css  js  c++  java
  • 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()

     

  • 相关阅读:
    一些有用的DNN方法
    将VB.Net反编译时StringType.StrCmp用C#中的函数string.Compare替换
    接一个DNN安装时的未知错误,终于找到了原因
    这是用performancing for firefox编写的blog
    这是用word2007发表的blog
    一个DNN安装时的未知错误
    后端——框架——切面框架——aop——Pointcut表达式
    Metroid Prime Chs 20101004
    第一财经周刊:书店的黄昏
    这年头连萝卜都靠不住了
  • 原文地址:https://www.cnblogs.com/pppoe/p/10388935.html
Copyright © 2011-2022 走看看