//今天放假没看东西,贴上以前的基础,没事看着玩

// String->->

    var myStr = "My name is LiuYashion";
console.log( myStr.length ); //
console.log( myStr.charAt() ); //M
console.log( myStr.charCodeAt() ); //77 (M)
console.log( myStr.indexOf("n") ); //
console.log( myStr.lastIndexOf("n") ); // console.log( String.fromCharCode() ); //M console.log( myStr.replace("My","His") ); //His name is LiuYashion 只能换一次,最前面的一个 console.log( myStr.substring(,) ); //LiuYashion,包含11,不包含21 console.log( myStr.toLowerCase() ); //my name is liuyashion
console.log( myStr.toUpperCase() ); //MY NAME IS LIUYASHION var myStr_1 = " My name is LiuYashion ";
console.log( myStr_1 ); // My name is LiuYashion
console.log( myStr_1.trim() ); //My name is LiuYashion // Number->-> var myArr = ["M","y"," ","n","a","m","e"," ","i","s"," ","L","i","u","Y","a","s","h","i","o","n"];
console.log( myArr.length ); //
console.log( myArr.indexOf("n") ); //
console.log( myArr.lastIndexOf("n") ); //20 // Math->-> console.log( Math.round(3.6) ); //4 四舍五入
console.log( Math.abs(-3.3) ); //3.3 绝对值
console.log( Math.ceil(-3.3) ); //-3 向上取整
console.log( Math.floor(-3.3) ); //-4 向下取整
console.log( Math.pow(,) ); //8 2的3次方
console.log( Math.sqrt() ); //3 9开方
console.log( Math.max(3.3,,) ); //30 最大值 // Date->->
var myDate = new Date('2016/3/21 23:11:11');
var nowDate = new Date(); //Wed Mar 23 2016 11:02:22 GMT+0800 (中国标准时间) console.log( nowDate.getFullYear() ); //2016 (number类型)
console.log( nowDate.getMonth() ); //2 月份是0-11
console.log( nowDate.getDate() ); //23 日期是从1开始 console.log( myDate.getDay() ); //1 星期一
console.log( myDate.getHours() ); //
console.log( myDate.getMinutes() ); //
console.log( myDate.getSeconds() ); // console.log( myDate.setFullYear() ); //1220886671000 距离1970.1.1的毫秒数.
console.log("-------------"+myDate)
console.log( myDate.setMonth() ); //1220886671000 距离1970.1.1的毫秒数
console.log( myDate.setDate() ); //1220886671000 距离1970.1.1的毫秒数 console.log( myDate ); //Mon Sep 08 2008 23:11:11 GMT+0800 (中国标准时间) var firstDate = new Date('2016/3/24 11:11:11');
var secondDate = new Date(); var spare = firstDate - secondDate; var spare_s = parseInt(spare/); // spare_s 总共的秒数
var spare_seconds = spare_s%; // spare_seconds 余下秒数 var spare_m = parseInt(spare_s/); // spare_m 总共分钟数
var spare_minutes = spare_m%; // spare_minutes 余下的分钟 var spare_h = parseInt(spare_m/); // spare_h 总共小时数
var spare_hours = spare_h%; // spare_hours 余下小时数 var spare_days = parseInt(spare_h/); // spare_days 总共的天数 console.log(spare_days+"天"+spare_hours+"小时"+spare_minutes+"分钟"+spare_seconds+"秒");
// 0天21小时18分钟15秒 var date_1 = new Date('1970/1/1');
console.log( Date.parse(date_1) ); //946656000000,距离1970.1.1的毫秒数 var my_date = new Date();
console.log( my_date.getFullYear()+"/"+ (my_date.getMonth()+) +"/"+ my_date.getDate() );
//2016/3/23

JS中的String.Math.Date的更多相关文章

  1. js中关于string转date类型的转换

    var date_up = input.split("-");//input表示string类型(时间例如:2017-11-12 10:07:36.653) var date_do ...

  2. javaScript系列:js中获取时间new Date()详细介绍

    var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份(4位,1970-????)m ...

  3. js中获取时间new date()的用法

    获取时间: var myDate = new Date();//获取系统当前时间 获取特定格式的时间: myDate.getYear(); //获取当前年份(2位) myDate.getFullYea ...

  4. js中获取时间new Date()详细介绍

    var myDate = new Date();myDate.getYear(); //获取当前年份(2位)myDate.getFullYear(); //获取完整的年份(4位,1970-????)m ...

  5. JavaScript -- 时光流逝(三):js中的 String 对象的方法

    JavaScript -- 知识点回顾篇(三):js中的 String 对象的方法 (1) anchor(): 创建 HTML 锚. <script type="text/javasc ...

  6. js中获取时间new date()的用法和获取时间戳

    获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getF ...

  7. 小程序 js中获取时间new date()的用法(网络复制过来自用)

    js中获取时间new date()的用法   获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获 ...

  8. js中获取时间new date()的用法 获取时间:

    获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getF ...

  9. Js中获取时间 new date()的用法

    Js中获取时间 new date()的用法 获取时间: var myDate = new Date();//获取系统当前时间 myDate.getYear(); //获取当前年份(2位) myDate ...

随机推荐

  1. DedeCMS提交自定义表单加入验证码功能

    织梦dedecms网站给自定义表单加dede模板自带验证码的方法. 有时候,我们因为需要给dede网站的自定义表单添加验证码,防止恶意填写表单提交. 我们可以用以下的方法来实现: 首先,我们要找到 / ...

  2. HDU5812 Distance(枚举 + 分解因子)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5812 Description In number theory, a prime is a ...

  3. oracle存储海量数据 设计方案

    日历基本活动表的数据有四千万条,在这些生产库业务中是小的了. 从三个方面提高效率: 1.sql语句 要绑定变量,sql语句书写规范这些,包括的就多了.主要目的就是提高数据库吞吐量及业务SQL响应时间. ...

  4. Extjs用到的一些有用的网页的集锦

    1. extJS常用的4中Ajax异步提交 http://www.2cto.com/kf/201403/284083.html http://blog.csdn.net/goodshot/articl ...

  5. BZOJ4657 : tower

    显然只有横向和纵向的两个炮塔才有可能冲突. 考虑最小割,将每个炮塔所有能攻击到的位置建点,相邻之间连无穷的边,表示前缀和关系,即选了一个点,就必须要选所有比它近的点. 属于横向炮塔的点向$S$连边,容 ...

  6. select 支持宽高(高度有兼容问题);

    <select size=1(默认) size=2 没有下拉效果> <option selected>12</option> <option selected ...

  7. mysql数据向Redis快速导入

    Redis协议 *<args><cr><lf> 参数个数 $<len><cr><lf> 第一个参数长度 <arg0> ...

  8. Codeforces Round #249 (Div. 2) A. Black Square

    水题 #include <iostream> #include <vector> #include <algorithm> using namespace std; ...

  9. POI2012 (持续更新中)

    Distance Well Vouchers Cloakroom A Horrible Poem Rendezvous Fibonacci Representation Squarks Salarie ...

  10. 【BZOJ3224】Tyvj 1728 普通平衡树 Splay

    Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名(若有多个相同的数 ...