81,091
社区成员
发帖
与我相关
我的任务
分享
public class test {
public static void main(String[] args) {
String endDate = "9-3-2011 11:22 am GMT";
DateTimeFormatter fmt = DateTimeFormat.forPattern("MM-dd-yyyy HH:mm aa zzz");
try{
DateTime expiration = fmt.parseDateTime(endDate);
} catch(Exception e) {
System.out.println(e.getMessage());
}
}
}
public class test {
public static void main(String[] args) {
String endDate = "9-3-2011 11:22 am GMT";
DateTimeFormatter fmt = new DateTimeFormatterBuilder()
.appendDayOfMonth(2)
.appendLiteral("-")
.appendMonthOfYear(2)
.appendLiteral("-")
.appendYear(4,4)
.appendLiteral(" ")
.appendHourOfHalfday(2)
.appendLiteral(":")
.appendMinuteOfHour(2)
.appendLiteral(" ")
.appendHalfdayOfDayText()
.appendLiteral(" ")
.appendTimeZoneName()
.toFormatter();
try{
DateTime expiration = fmt.parseDateTime(endDate);
} catch(Exception e) {
System.out.println(e.getMessage());
}
}
}
SimpleDateFormat fr=new SimpleDateFormat("yyyy-MM-dd");
fr.parse(endDate);