把格式为:
27/May/2010:00:00:00
转化成格式为:
yyyy-MM-dd HH:mm:ss
悲剧了... 没搞定
把格式为:
27/May/2010:00:00:00
转化成格式为:
yyyy-MM-dd HH:mm:ss
悲剧了... 没搞定
[b][color=blue]看看SimpleDateFormat的api就知道怎么做了[/color][/b]
[code="java"]
public static void main(String[] args) throws Exception {
String date = "27/May/2010:00:00:00";
// 如果date字串中的是月份是英文全称的会话, 就用MMMMM
DateFormat srcFormat = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss", Locale.US);
DateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
String targetDate = targetFormat.format(srcFormat.parse(date));
System.out.println(targetDate);
}
[/code]