把格式日期转换成毫秒
2012-09-08 18:15
344 查看
/** * 把"yyyy-MM-dd HH:mm:ss"格式日期转换成毫秒 *@param strDate *@return 转换后毫秒的值 *@author hongj */ public long paseDateTomillise(String strDate){ String year = null; String month = null; String day = ""; String hms = ""; if(strDate.contains(" ") && !strDate.endsWith(" ")){ String[] s = strDate.split(" "); hms = s[1]; } String[] getYear = strDate.split("-"); year = getYear[0].substring(2, 4); month = getYear[1]; if("1".equalsIgnoreCase(month) || "01".equalsIgnoreCase(month)){ month = "JAN"; }else if("2".equalsIgnoreCase(month) || "02".equalsIgnoreCase(month)){ month = "FEB"; }else if("3".equalsIgnoreCase(month) || "03".equalsIgnoreCase(month)){ month = "MAR"; }else if("4".equalsIgnoreCase(month) || "04".equalsIgnoreCase(month)){ month = "APR"; }else if("5".equalsIgnoreCase(month) || "05".equalsIgnoreCase(month)){ month = "MAY"; }else if("6".equalsIgnoreCase(month) || "06".equalsIgnoreCase(month)){ month = "JUN"; }else if("7".equalsIgnoreCase(month) || "07".equalsIgnoreCase(month)){ month = "JUL"; }else if("8".equalsIgnoreCase(month) || "08".equalsIgnoreCase(month)){ month = "AUG"; }else if("9".equalsIgnoreCase(month) || "09".equalsIgnoreCase(month)){ month = "SEPT"; }else if("10".equalsIgnoreCase(month)){ month = "OCT"; }else if("11".equalsIgnoreCase(month)){ month = "NOV"; }else if("12".equalsIgnoreCase(month)){ month = "DEC"; } if(getYear[2].contains(" ")){ day = getYear[2].split(" ")[0]; }else{ day = getYear[2]; } String datees = day+"-"+month+"-"+year+" "+hms; Date datee = new Date(datees); return datee.getTime(); }
相关文章推荐
- iphone开发毫秒数转换成日期格式
- 时间格式的转换日期转换毫秒
- Java毫秒转换成日期格式
- java中日期时间格式与毫秒数的转换
- 由毫秒(ms)转换为日期和时间的格式(简单易用)
- JS、Jquery实现---把后台传过来的时间毫秒数转换成想要的日期格式
- 将毫秒时间转换成日期时间格式
- 在JS中如何把毫秒转换成规定的日期时间格式实例
- jsp页面-把毫秒数转换成日期格式
- Java中日期时间格式与毫秒数的相互转换
- android开发:日期格式大全以及把毫秒转换成日期格式
- 用js将从后台得到的时间戳(毫秒数)转换为想要的日期格式
- js将毫秒转换成指定格式的日期时间
- ArcMap中毫秒转换为日期格式
- 毫秒数转换为指定格式日期的js代码
- 用js将从后台得到的时间戳(毫秒数)转换为想要的日期格式
- js时间戳(毫秒数)转换为日期格式
- JS中将毫秒转换成任意日期格式
- js中Date日期格式转换以及时间和毫秒之间的转换
- java中日期格式之间的转换yyyy-MM-dd HH:mm:ss和毫秒数之间