1. var t = new Date().toString(); //t = "Thu Oct 31 2019 11:36:57 GMT+0800 (中国标准时间)"
  2. var t1 = new Date();
  3. var data_arry =[];
  4. var that = new Date();
  5. data_arry.push(that.constructor()); // Thu Oct 31 2019 11:50:26 GMT+0800 (中国标准时间)"
  6. data_arry.push(that.getDate()); //
  7. data_arry.push(that.getDay()); //
  8. data_arry.push(that.getFullYear()); //
  9. data_arry.push(that.getHours()); //
  10. data_arry.push(that.getMilliseconds()); //
  11. data_arry.push(that.getMinutes()); //
  12. data_arry.push(that.getMonth()); //
  13. data_arry.push(that.getSeconds()); //
  14. data_arry.push(that.getTime()); //
  15. data_arry.push(that.getTimezoneOffset()); //-480
  16. data_arry.push(that.getUTCDate()); //
  17. data_arry.push(that.getUTCDay());
  18. data_arry.push(that.getUTCFullYear());
  19. data_arry.push(that.getUTCHours());
  20. data_arry.push(that.getUTCMilliseconds());
  21. data_arry.push(that.getUTCMinutes());
  22. data_arry.push(that.getUTCMonth());
  23. data_arry.push(that.getUTCSeconds());
  24. data_arry.push(that.getYear());
  25. data_arry.push(that.setDate());
  26. data_arry.push(that.setFullYear());
  27. data_arry.push(that.setHours());
  28. data_arry.push(that.setMilliseconds());
  29. data_arry.push(that.setMinutes());
  30. data_arry.push(that.setMonth());
  31. data_arry.push(that.setSeconds());
  32. data_arry.push(that.setTime());
  33. data_arry.push(that.setUTCDate());
  34. data_arry.push(that.setUTCFullYear());
  35. data_arry.push(that.setUTCHours());
  36. data_arry.push(that.setUTCMilliseconds());
  37. data_arry.push(that.setUTCMinutes());
  38. data_arry.push(that.setUTCMonth());
  39. data_arry.push(that.setUTCSeconds());
  40. data_arry.push(that.setYear());
  41. data_arry.push(that.toDateString());
  42. data_arry.push(that.toGMTString());
  43. //data_arry.push(that.toISOString()); 报错
  44. data_arry.push(that.toJSON());
  45. data_arry.push(that.toLocaleDateString());
  46. data_arry.push(that.toLocaleString());
  47. data_arry.push(that.toLocaleTimeString());
  48. data_arry.push(that.toString());
  49. data_arry.push(that.toTimeString());
  50. data_arry.push(that.toUTCString());
  51. data_arry.push(that.valueOf());
  1. function get_nowtime() {
  2. var date = new Date();
  3. return (date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate());
  4. }
  5. console.log(get_nowtime());
  1. function get_nowtime() {
  2. function format(str) {
  3. str += "";
  4. if (str.length < 2) {
  5. str = "0" + str;
  6. }
  7. return str;
  8. }
  9. var date = new Date();
  10. return (date.getFullYear() + '-' + format((date.getMonth() + 1)) + '-' + format(date.getDate()));
  11. }

js  时间字符串转时间

  1. layui.use('laydate', function () {
  2. var laydate = layui.laydate;
  3. laydate.render({
  4. elem: '#test1'
  5. ,format: 'yyyy-MM-dd' //可任意组合,
  6. , value: new Date(document.getElementById('test1').value) //必须遵循format参数设定的格式
  7. });
  8. });

js new Date() 测试的更多相关文章

  1. JS的Date对象、Math、包装类

    Date对象 在JS使用Date对象来表示时间  当前时间 var d = new Date();  指定时间 格式:月/日/年 时:分:秒 var e = new Date("02/16/ ...

  2. JavaScript基础17——js的Date对象

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. js对Date对象的操作的问题(生成一个倒数7天的数组)

    今天在论坛上看到这样一个问题如下: 问题描述: 使用JavaScript生成一个倒数7天的数组.比如今天是10月1号,生成的数组是["9月25号","9月26号" ...

  4. javascript得知 - js的Date对象函数

    js的Date功能很强大.通常使用. 首先获得当前的日期: var CurDate = new Date(); var Year = CurDate.getFullYear(); //年份(四位 例: ...

  5. 『开源』扩展 JS 的 Date 处理函数

    背景: JS 有自己的 时间类型 Date  —— 但是,在某些情况下 这个对象似乎 不太好用. 本文 基于 JQuery 扩展了一些  JS日期函数,包括: > 字符串 转 Date 对象 万 ...

  6. JS将/Date(1446704778000)/转换成str

    JS将/Date(1446704778000)/转换成str:var dateStr = eval(ele.add_time.replace(/\/Date\((\d+)\)\//gi, " ...

  7. JS日期Date详解与实例扩展

    一:Date类型介绍 要创建一个日期对象,使用new操作符和Date构造函数即可: var now = new Date(); Date.parse()方法 其中Date.parse()方法接收一个表 ...

  8. Chromimu与JS交互的测试

    CHROMIMU与JS交互的测试 好东西 谷歌浏览器 学习 研究  http://blog.csdn.net/grassdragon/article/details/51659798 Chromimu ...

  9. js转换Date日期格式

    有时候做项目会用到js的date日期格式,因为Date()返回的格式不是我们需要的, Date()返回格式: Thu Mar 19 2015 12:00:00 GMT+0800 (中国标准时间) 而我 ...

随机推荐

  1. CSS(下)

    目录 CSS(下) CSS属性相关 宽和高 字体属性 背景属性 边框 border-radius display属性 CSS盒子模型 margin外边距 padding内填充 浮动(float) 限制 ...

  2. spark教程(九)-操作数据库

    数据库也是 spark 数据源创建 df 的一种方式,因为比较重要,所以单独算一节. 本文以 postgres 为例 安装 JDBC 首先需要 安装 postgres 的客户端驱动,即 JDBC 驱动 ...

  3. Springboot提示数据库连接问题Connection is not available

    2019-05-29 11:19:51.824 WARN 854 --- [io-8080-exec-10] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL ...

  4. python网络爬虫(8)多媒体文件抽取

    目的 批量下载网页图片 导入库 urllib中的request中的urlretrieve方法,可以下载图片 lxml用于解析网页 requests用于获取网站信息 import urllib from ...

  5. javaScript基础知识总汇

    javaScript是什么: 1.JavaScript 运行在客户端(浏览器)的编程语言 2.用来给HTML网页增加动态功能 3.用来给HTML网页增加动态功能. 4.Netscape在最初将其脚本语 ...

  6. c# ListView 简单操作

    1. 添加数据 listView1.Items.Clear(); for (int i = 0; i < 50; i++) { ListViewItem lv = new ListViewIte ...

  7. 爬取YY评级信息

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @File : 爬取YY评级基本信息.py # @Author: lattesea # @Date : ...

  8. 谷歌浏览器(Chrome)离线包的下载方法!

    谷歌浏览器(Chrome)其实可以下载离线包,用离线包安装的好处,就是一次获得全部安装文件,不需要漫长的在线下载过程了! 下载地址:https://www.google.com/chrome/eula ...

  9. Alpha阶段评审

    组别  项目名称 学生互评 助教评分 点评建议 第1组 校园物资共享平台 7.97 6.17 界面较为简洁美观,实现物品信息发布,登录注册和个人信息等功能,交易功能待完善: 博客内容比较完善,有alp ...

  10. Delphi 过程