...
|
...
|
@@ -10,6 +10,7 @@ import java.time.format.DateTimeFormatter; |
|
|
import java.time.format.DateTimeParseException;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.Locale;
|
|
|
import java.util.TimeZone;
|
|
|
|
|
|
|
...
|
...
|
@@ -116,6 +117,11 @@ public final class DateUtil { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
Date date = formatByyyyyMMddHHmmss("20211031223300");
|
|
|
System.out.println(date);
|
|
|
}
|
|
|
|
|
|
//LocalDateTime转换为Date
|
|
|
public static Date convertLDTToDate(LocalDateTime time) {
|
|
|
return Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
|
...
|
...
|
@@ -570,9 +576,24 @@ public final class DateUtil { |
|
|
return weekDays[w];
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws ParseException {
|
|
|
String s = dateToWeek("20200815");
|
|
|
System.out.println(s);
|
|
|
|
|
|
/**
|
|
|
* 格式化航班日期类型
|
|
|
* @param dateStr
|
|
|
* @return
|
|
|
* @throws ParseException
|
|
|
*/
|
|
|
public static Date dateFormatFlight(String dateStr) throws ParseException{
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("ddMMMyyyy", Locale.ENGLISH);
|
|
|
try {
|
|
|
Date date = sdf.parse(dateStr);
|
|
|
System.out.println(date);
|
|
|
return date;
|
|
|
} catch (ParseException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|