Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.Date;
import java.text.SimpleDateFormat;  
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Locale;


class Main {
  public static void main(String[] args) throws Exception {
    System.out.println(Calendar.getInstance(Locale.getDefault()));
    DateTimeFormatter fmt1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    DateTimeFormatter fmt2 = DateTimeFormatter.ofPattern("yyyy-MM-dd ww");
    
    String sDate1 = "2018-12-29";
    LocalDate localDateTime = LocalDate.parse(sDate1, fmt1);


    System.out.println(fmt2.format(LocalDate.parse("2011-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2012-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2013-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2014-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2015-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2017-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2018-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2018-12-29", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2018-12-31", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2019-01-01", fmt1)));




    System.out.println(fmt2.format(LocalDate.parse("2016-01-01", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-02", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-03", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-04", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-05", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-06", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-07", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-08", fmt1)));
    System.out.println(fmt2.format(LocalDate.parse("2016-01-09", fmt1)));

  }
}