js new Date() 测试
var t = new Date().toString(); //t = "Thu Oct 31 2019 11:36:57 GMT+0800 (中国标准时间)"
var t1 = new Date();
var data_arry =[];
var that = new Date();
data_arry.push(that.constructor()); // Thu Oct 31 2019 11:50:26 GMT+0800 (中国标准时间)"
data_arry.push(that.getDate()); //
data_arry.push(that.getDay()); //
data_arry.push(that.getFullYear()); //
data_arry.push(that.getHours()); //
data_arry.push(that.getMilliseconds()); //
data_arry.push(that.getMinutes()); //
data_arry.push(that.getMonth()); //
data_arry.push(that.getSeconds()); //
data_arry.push(that.getTime()); //
data_arry.push(that.getTimezoneOffset()); //-480
data_arry.push(that.getUTCDate()); //
data_arry.push(that.getUTCDay());
data_arry.push(that.getUTCFullYear());
data_arry.push(that.getUTCHours());
data_arry.push(that.getUTCMilliseconds());
data_arry.push(that.getUTCMinutes());
data_arry.push(that.getUTCMonth());
data_arry.push(that.getUTCSeconds());
data_arry.push(that.getYear());
data_arry.push(that.setDate());
data_arry.push(that.setFullYear());
data_arry.push(that.setHours());
data_arry.push(that.setMilliseconds());
data_arry.push(that.setMinutes());
data_arry.push(that.setMonth());
data_arry.push(that.setSeconds());
data_arry.push(that.setTime());
data_arry.push(that.setUTCDate());
data_arry.push(that.setUTCFullYear());
data_arry.push(that.setUTCHours());
data_arry.push(that.setUTCMilliseconds());
data_arry.push(that.setUTCMinutes());
data_arry.push(that.setUTCMonth());
data_arry.push(that.setUTCSeconds());
data_arry.push(that.setYear());
data_arry.push(that.toDateString());
data_arry.push(that.toGMTString());
//data_arry.push(that.toISOString()); 报错
data_arry.push(that.toJSON());
data_arry.push(that.toLocaleDateString());
data_arry.push(that.toLocaleString());
data_arry.push(that.toLocaleTimeString());
data_arry.push(that.toString());
data_arry.push(that.toTimeString());
data_arry.push(that.toUTCString());
data_arry.push(that.valueOf());
function get_nowtime() {
var date = new Date();
return (date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate());
}
console.log(get_nowtime());
function get_nowtime() {
function format(str) {
str += "";
if (str.length < 2) {
str = "0" + str;
}
return str;
}
var date = new Date();
return (date.getFullYear() + '-' + format((date.getMonth() + 1)) + '-' + format(date.getDate()));
}
js 时间字符串转时间
layui.use('laydate', function () {
var laydate = layui.laydate;
laydate.render({
elem: '#test1'
,format: 'yyyy-MM-dd' //可任意组合,
, value: new Date(document.getElementById('test1').value) //必须遵循format参数设定的格式
});
});
js new Date() 测试的更多相关文章
- JS的Date对象、Math、包装类
Date对象 在JS使用Date对象来表示时间 当前时间 var d = new Date(); 指定时间 格式:月/日/年 时:分:秒 var e = new Date("02/16/ ...
- JavaScript基础17——js的Date对象
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- js对Date对象的操作的问题(生成一个倒数7天的数组)
今天在论坛上看到这样一个问题如下: 问题描述: 使用JavaScript生成一个倒数7天的数组.比如今天是10月1号,生成的数组是["9月25号","9月26号" ...
- javascript得知 - js的Date对象函数
js的Date功能很强大.通常使用. 首先获得当前的日期: var CurDate = new Date(); var Year = CurDate.getFullYear(); //年份(四位 例: ...
- 『开源』扩展 JS 的 Date 处理函数
背景: JS 有自己的 时间类型 Date —— 但是,在某些情况下 这个对象似乎 不太好用. 本文 基于 JQuery 扩展了一些 JS日期函数,包括: > 字符串 转 Date 对象 万 ...
- JS将/Date(1446704778000)/转换成str
JS将/Date(1446704778000)/转换成str:var dateStr = eval(ele.add_time.replace(/\/Date\((\d+)\)\//gi, " ...
- JS日期Date详解与实例扩展
一:Date类型介绍 要创建一个日期对象,使用new操作符和Date构造函数即可: var now = new Date(); Date.parse()方法 其中Date.parse()方法接收一个表 ...
- Chromimu与JS交互的测试
CHROMIMU与JS交互的测试 好东西 谷歌浏览器 学习 研究 http://blog.csdn.net/grassdragon/article/details/51659798 Chromimu ...
- js转换Date日期格式
有时候做项目会用到js的date日期格式,因为Date()返回的格式不是我们需要的, Date()返回格式: Thu Mar 19 2015 12:00:00 GMT+0800 (中国标准时间) 而我 ...
随机推荐
- Apache Zookeeper 集群环境搭建
Zookeeper 是 一个分布式.开放源码的分布式应用程序协调服务,是Google Chubby的一个开源实现,大多数的分布式应用都需要Zookeeper的支持,这篇文章先简单的和大家分享如何搭建一 ...
- thinkphp5.1 关于加载静态资源路径问题
和thinkphp5.0不一样,thinkphp5.1的 thinkphp5.0的 直接在config.php文件中加入代码: <?phpreturn [ 'view_replace_str' ...
- java web 二维码生成
pom支持: <!-- 二维码支持包 start--> <dependency> <groupId>com.google.zxing</groupId> ...
- pip 更新命令
更新pip的命令 https://pip.pypa.io/
- the Percentage Layout of Android (安卓的百分比布局)
不用wrap_content.match_parent来指定 控件的大小, 1.在app/bulid.gradle文件的dependencies中添加 compile 'com.android.sup ...
- 1.device-manage 优化
一.当前简介 版本信息 device-manage:v1.0 mysql: 5.6.20 jdk : 1.8 Apache Maven 3.3.3 Spring4.2.5.RELEAS+SpingMV ...
- 外网访问VMware(Centos7.0,NAT模式)搭建的web服务器应用
首先参考 https://www.cnblogs.com/studyhard-cq/p/11551755.html 设置好NAT模式,能访问公网. 1.打开VMware,点击左上角编辑 ...
- copy模块与fetch模块
copy:将本地机器上的文件拷贝到远程机器 fetch:将远程机器上的文件拷贝到本地机器 [root@localhost zabbix]# ansible-doc -s copy - name: Co ...
- C#和Java的最大不同
本文摘抄自知乎. 作者:匿名用户链接:https://www.zhihu.com/question/20451584/answer/27163009来源:知乎著作权归作者所有.商业转载请联系作者获得授 ...
- 阿里云(ecs服务器)使用1-设置安全组
1.进入阿里云的控制台https://ecs.console.aliyun.com/?#/server/region/cn-qingdao,点击管理 2.点击左边的 本实例安全组 3. 点击加入配置规 ...