Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created May 21, 2018 12:44
Show Gist options
  • Save zhangkn/dd06779a320bbb52bcccd845a7f94729 to your computer and use it in GitHub Desktop.
Save zhangkn/dd06779a320bbb52bcccd845a7f94729 to your computer and use it in GitHub Desktop.
//生成 date 对象需要使用 getDate函数, 返回一个当前时间的对象。
getDate()
getDate(milliseconds)//milliseconds: 从1970年1月1日00:00:00 UTC开始计算的毫秒数
getDate(datestring)//datestring: 日期字符串,其格式为:"month day, year hours:minutes:seconds"
getDate(year, month[, date[, hours[, minutes[, seconds[, milliseconds]]]]])
var date = getDate(); //返回当前时间对象
date = getDate(1500000000000);
// Fri Jul 14 2017 10:40:00 GMT+0800 (中国标准时间)
date = getDate('2017-7-14');
// Fri Jul 14 2017 00:00:00 GMT+0800 (中国标准时间)
date = getDate(2017, 6, 14, 10, 40, 0, 0);
// Fri Jul 14 2017 10:40:00 GMT+0800 (中国标准时间)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment