- /**
- * 将格式为yyyy-MM-dd hh:mm:ss.S的字符串转为Date
- * @param dateString 时间字符串
- */
- function convertToDate(dateString){
- return new Date(dateString.replace(/\\-/g,"/"));
- }
- /**
- * 比较时间
- * @param date1
- * @param date2
- */
- function compareDate(date1, date2) {
- return date1.getTime() - date2.getTime();
- }
- //该片段来自于http://www.codesnippet.cn/detail/2004201512340.html
来源: http://www.codesnippet.cn/detail/2004201512340.html