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

// 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. ACM: HDU 1028 Ignatius and the Princess III-DP

     HDU 1028 Ignatius and the Princess III Time Limit:1000MS     Memory Limit:32768KB     64bit IO Form ...

  2. require.js 入门学习 (share)

    以下内容转自阮一峰老师的网络日志:http://www.ruanyifeng.com/blog/2012/11/require_js.html 更多学习资源: require.js官网:http:// ...

  3. 第一天 Linux 是什么

    众所周知,Linux的核心原型是1991年由托瓦兹(Linus Torvalds)写出来 计算机是由一堆硬件所组成的,为了有敁率的控制这些硬件资源,于是乎就有操作系统产生了.       到了1985 ...

  4. BZOJ3442: 学习小组

    Description [背景] 坑校准备鼓励学生参加学习小组. [描述]     共有n个学生,m个学习小组,每个学生有一定的喜好,只愿意参加其中的一些学习小组,但是校领导为学生考虑,规定一个学生最 ...

  5. Application Initialization Module for IIS 7.5

    http://www.iis.net/downloads/microsoft/application-initialization IIS7.5也有Warm Up功能 让ASP.NET第一次Reque ...

  6. 升级WebService图形服务,将K10.2和K10.3写到一个类库,所有服务放在一个类库

    问题描述: 平时负责电子政务和图形调用部分,凡是牵涉到图形的都需要调用WebService服务,因此很多工程都需要添加web服务引用,现在WebForm的工程一个是10.2版本,一个是10.3版本,区 ...

  7. 用css3实现一个带缺口的圆圈(图)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Hadoop.2.x_源码编译

    一.基本环境搭建 1. 准备 hadoop-2.5.0-src.tar.gz apache-maven-3.0.5-bin.tar.gz jdk-7u67-linux-x64.tar.gz proto ...

  9. Linux_文件打包,压缩,解压

    一.压缩命令 文件格式:*.gz 命令:gzip 文件名 (ps:不能压缩目录,切压缩后不保留原文件) 压缩前 -rw-r--r--. 1 root root 315 Sep 6 21:03 df.t ...

  10. HTML 父元素与子元素之间的margin-top问题

    问题: 父元素的盒子包含一个子元素盒子,给子元素盒子一个垂直外边距margin-top,父元素盒子也会往下走margin-top的值,而子元素和父元素的边距则没有发生变化. 代码如下: <div ...