JS获取当前日期时间

var myDate = new Date();
myDate.getFullYear();    //获取完整的年份(4位,1970-????)
myDate.getMonth();       //获取当前月份(0-11,0代表1月)
myDate.getDate();        //获取当前日(1-31)
myDate.getDay();         //获取当前星期X(0-6,0代表星期天)
myDate.getTime();        //获取当前时间(从1970.1.1开始的毫秒数)
myDate.getHours();       //获取当前小时数(0-23)
myDate.getMinutes();     //获取当前分钟数(0-59)
myDate.getSeconds();     //获取当前秒数(0-59)
myDate.getMilliseconds();    //获取当前毫秒数(0-999)
myDate.toLocaleDateString();     //获取当前日期
myDate.toLocaleTimeString();     //获取当前时间
myDate.toLocaleString( );        //获取日期与时间

转载:http://www.cnblogs.com/carekee/articles/1678041.html

最新文章

  1. python运算符重载
  2. 根据用户IP获得所在城市
  3. aptana studio 3 自动换行(无需插件)
  4. CENTOS纯手工安装LAMP+PHPMYADMIN
  5. Multi-touch.
  6. 在Fedora 23 Server和Workstation上安装LAMP(Linux, Apache, MariaDB和PHP)
  7. Android 测试 Appium、Robotium、monkey等框架或者工具对比
  8. CubeSuit+ ( CS+ for ca )
  9. [CEOI2008]order
  10. Java 线程安全LocalTime 和LocaldateTime 新的Date和Time类 -JDK8新时间类的简单使用
  11. Python面向对象之魔术方法
  12. Bootloader升级方式一————擦、写flash在RAM中运行
  13. Spark设计理念与基本架构
  14. js 把一个对象赋值给另一个对象会指向同一个内存地址
  15. python中global和nonlocal用法的详细说明
  16. spring boot 2.0.3+spring cloud (Finchley)1、搭建服务注册和发现组件Eureka 以及构建高可用Eureka Server集群
  17. 创建一个Maven Web应用程序
  18. 线程 Thread Handler
  19. [LeetCode] 711. Number of Distinct Islands II_hard tag: DFS
  20. [C#学习笔记]C#中的decimal类型——《CLR via C#》

热门文章

  1. ubuntu14.04 python3.*连接mysql
  2. 使用Swift打造动态库SDK和DemoAPP时所遇到的(Xcode7.3)
  3. 使用Maven Assembly plugin将依赖打包进jar
  4. AngularJS 的嵌套路由 UI-Router
  5. javascript读取xml文件
  6. C#的winform控件命名规范
  7. JS控制flash的方法
  8. Dom4j把xml转换成Map(非固定格式)
  9. ASP.NET中使用JqGrid完整实现
  10. linux 命令行 光标移动技巧