Skip to content

Instantly share code, notes, and snippets.

@loethen
Created April 21, 2017 07:55
Show Gist options
  • Save loethen/6d7c54a005f47f892329b8078580df03 to your computer and use it in GitHub Desktop.
Save loethen/6d7c54a005f47f892329b8078580df03 to your computer and use it in GitHub Desktop.
ios微信日期转换
// ios 时间转时间戳
// 兼容所有浏览器
// ios 使用 new Date("2010-03-15 10:30:00").getTime() 获取时间戳报错
// @time "2010-03-15 10:30:00"
function getTs(time){
var arr = time.split(/[- :]/),
_date = new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]),
timeStr = Date.parse(_date)
return timeStr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment