Created
April 21, 2017 07:55
-
-
Save loethen/6d7c54a005f47f892329b8078580df03 to your computer and use it in GitHub Desktop.
ios微信日期转换
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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