|
7 | 7 | import java.time.temporal.TemporalAdjusters; |
8 | 8 |
|
9 | 9 | public class UseLocalDate { |
10 | | - |
11 | | - public LocalDate getLocalDateUsingFactoryOfMethod(int year, int month, int dayOfMonth){ |
| 10 | + |
| 11 | + public LocalDate getLocalDateUsingFactoryOfMethod(int year, int month, int dayOfMonth) { |
12 | 12 | return LocalDate.of(year, month, dayOfMonth); |
13 | 13 | } |
14 | | - |
15 | | - public LocalDate getLocalDateUsingParseMethod(String representation){ |
| 14 | + |
| 15 | + public LocalDate getLocalDateUsingParseMethod(String representation) { |
16 | 16 | return LocalDate.parse(representation); |
17 | 17 | } |
18 | | - |
19 | | - public LocalDate getLocalDateFromClock(){ |
| 18 | + |
| 19 | + public LocalDate getLocalDateFromClock() { |
20 | 20 | LocalDate localDate = LocalDate.now(); |
21 | 21 | return localDate; |
22 | 22 | } |
23 | | - |
24 | | - public LocalDate getNextDay(LocalDate localDate){ |
| 23 | + |
| 24 | + public LocalDate getNextDay(LocalDate localDate) { |
25 | 25 | return localDate.plusDays(1); |
26 | 26 | } |
27 | | - |
28 | | - public LocalDate getPreviousDay(LocalDate localDate){ |
| 27 | + |
| 28 | + public LocalDate getPreviousDay(LocalDate localDate) { |
29 | 29 | return localDate.minus(1, ChronoUnit.DAYS); |
30 | 30 | } |
31 | | - |
32 | | - public DayOfWeek getDayOfWeek(LocalDate localDate){ |
| 31 | + |
| 32 | + public DayOfWeek getDayOfWeek(LocalDate localDate) { |
33 | 33 | DayOfWeek day = localDate.getDayOfWeek(); |
34 | 34 | return day; |
35 | 35 | } |
36 | | - |
37 | | - public LocalDate getFirstDayOfMonth(){ |
| 36 | + |
| 37 | + public LocalDate getFirstDayOfMonth() { |
38 | 38 | LocalDate firstDayOfMonth = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()); |
39 | 39 | return firstDayOfMonth; |
40 | 40 | } |
41 | | - |
42 | | - public LocalDateTime getStartOfDay(LocalDate localDate){ |
| 41 | + |
| 42 | + public LocalDateTime getStartOfDay(LocalDate localDate) { |
43 | 43 | LocalDateTime startofDay = localDate.atStartOfDay(); |
44 | 44 | return startofDay; |
45 | 45 | } |
|
0 commit comments