Last active
December 19, 2015 13:48
-
-
Save GongLe/5964267 to your computer and use it in GitHub Desktop.
javascript转换日期字符串为Date对象
This file contains hidden or 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
| /** | |
| 日期格式字符串转为Date.getTime对象 | |
| @param str 日期格式字符串 | |
| @return Date time | |
| <p> | |
| eg: string2Date(2013-07-13 10:00:00' ) -> 1373700600000 | |
| </p> | |
| **/ | |
| function string2Date(str){ | |
| return (new Date(Date.parse(str.replace(/-/g, "/")))).getTime() ; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment