Skip to content

Commit 8983bcb

Browse files
committed
Dates, Strings and Localization
1 parent cfbf973 commit 8983bcb

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Java-8/src/datesStringsLocalization/DatesAndTimes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void manipulate() {
5252
System.out.println(dateTime); // 2020-01-18T19:14:30
5353
}
5454

55+
// For Period, you can specify the number of years, months, weeks or days.
5556
public void period() {
5657
Period annually = Period.ofYears(1);
5758
Period quarterly = Period.ofMonths(3);

Java-8/src/datesStringsLocalization/FormattingDatesAndTimes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void test() {
4343
DateTimeFormatter fm = DateTimeFormatter.ofPattern("MM dd yyyy");
4444
LocalDate date1 = LocalDate.parse("01 02 2015", fm);
4545
LocalTime time1 = LocalTime.parse("11:22");
46-
System.out.println(date1); // 2017–06–09
46+
System.out.println(date1); // 2015–01–02
4747
System.out.println(time1); // 11:22
4848
}
4949

Java-8/src/datesStringsLocalization/FormattingNumbers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public void test() throws ParseException {
4242
String one = "456abc";
4343
String two = "-2.5165x10";
4444
String three = "x85.3";
45-
System.out.println(nf.parse(one));
46-
System.out.println(nf.parse(two));
45+
System.out.println(nf.parse(one)); // 456
46+
System.out.println(nf.parse(two)); // -2.5165
4747
// System.out.println(nf.parse(three)); // throws ParseException
4848
}
4949

0 commit comments

Comments
 (0)