package chap3CoreJavaAPIs;

import java.util.Calendar;
import java.time.Month;
import java.time.*;

class Dates{
	public static void main(String... args){
		// Be careful, old API Calendar starts at 0, new Month starts at 1
		System.out.println(Calendar.APRIL);
		System.out.println(Month.APRIL);
		System.out.println(LocalDate.of(2015, Month.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.APRIL, 1));
		System.out.println(LocalDate.of(2015, Calendar.MAY, 1).equals(LocalDate.of(2015, Month.APRIL, 1)));

		System.out.println(Period.ofMonths(1));
		System.out.println(Period.ofMonths(1).ofDays(2));
		System.out.println(Period.ofDays(2));
	}
}
@@ -110,17 +110,290 @@
 ss Dates
-%7B
+ %7B%0D%0A%0D%0A%09public void createDateFromString() %7B%0D%0A%09%09Date date = new SimpleDateFormat(%22yyyy-MM-dd'T'HH:mm:ss.SSS'Z'%22).parse(%222012-05-20T09:00:00.000Z%22);%0D%0A%09%09String formattedDate = new SimpleDateFormat(%22yyyy-MM-dd'T'HHmmss%22).format(date);%0D%0A%09%09System.out.println(formattedDate);%0D%0A%09%7D%0D%0A
 %0D%0A%09publi
@@ -426,16 +426,17 @@
 .. args)
+ 
 %7B%0D%0A%09%09// 

Create a date object from a string representing a date