先讲简单API
获取
var d = new Data() // 时间戳 返回距1970年1月1日的毫秒数
d.getTime( ) 方法可返回距 1970 年 1 月 1 日之间的毫秒数。
d.getMonth( ) 获取当前的月份(从0开始)+1
d.getDate( ) 获取当前日期
d.getDay( ) 获取星期
d.getHours( ) 获取小时
d.getMinutes( ) 获取分钟
d.getSeconds( )获取秒
d.getMilliseconds( ) 获取毫秒数
设置
setFullYear( ) 设置年份
setMonth( )设置月份
setDate( )设置日期
转换
toString( )转换成本地时间显示
toLocaleString( ) 转换成本地格式的时间
toLocaleDateString( ) 转换成本地格式的时间
toGMTString() 格林尼治标准时间 世界时
日期转字符串的三种方法(重要)
(能返回设置的日期的时间戳)
Date.parse( " 年月日" )
new Date( ).getTime( )
+new Date( )
时间戳日期(重要)
var date = new Date(1523199394644);//参数:毫秒值