java
1import java.time.*;
2import java.time.format.DateTimeFormatter;
3import java.util.Locale;
4import java.util.Date;
5public class SQLD {
6 public static void main(String[] args) {
7
8 DateTimeFormatter f =
9 DateTimeFormatter.ofPattern("MMM dd, yyyy",Locale.US);
10 String f22 = "Dec 26, 2016";
11 LocalDate dateTime = LocalDate.parse(f22, f);
12 System.out.println(dateTime);
13
14 Date a=toDate(dateTime);
15 System.out.println(a);
16
17 }
18
19
20public static Date toDate(LocalDateTime g) {
21 return Date.from(g.atZone(ZoneId.systemDefault()).toInstant());
22}
23
24public static Date toDate(LocalDate h) {
25 return toDate(h.atStartOfDay());
26}
27
28
29}
30
31
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/21 14:33
2016/12/21 15:31