Sat. Dec 21st, 2024
This entry is part 34 of 37 in the series Class Reviews

Link to Class: https://www.udemy.com/java-datetime/

Update: 3/18/2019
Section 1
Lecture 1: Introduction
Section 2
Lecture 3:  display current month, date, and time
Lecture 4: learn how to format hour, seconds, months and display them
Lecture 5:  display weekdays, show time in different language, add time to current …
Lecture 6: roll method in calendar, display different date formats
Lecture 7: roll method in calendar, display different date formats

I wrote down all the examples, don’t match up with the tutorial, or Java documentation. 
The only place I had any issues was the DAY_Of_MONTH type format which even on the tutorial sites does not work as stated.  I seem to recall, that there was an extra step to get the right numbers but I don’t see any examples of it.

Date d = new Date();
Calendar c1 = Calendar.getInstance();
c1.setTime(d); 

System.out.println(" " + c1.DAY_OF_MONTH + " Field number ... indicating the day of the month.");System.out.println(" " + c1.DAY_OF_WEEK + " Field number ... indicating the day of the week.");

System.out.println(" " + c1.DAY_OF_WEEK_IN_MONTH + " Field number ... indicating the ordinal number of the day of the week within the current month.");

System.out.println(" " + c1.DAY_OF_YEAR + " Field number ... indicating the day number within the current year."); 

System.out.println(" " + c1.WEEK_OF_MONTH + " Field number ... indicating the week number within the current month."); 

System.out.println(" " + c1.WEEK_OF_YEAR + " Field number ... indicating the week number within the current year."); System.out.println(" " + c1.YEAR + " Field number ... indicating the year."); 
Series Navigation<< Udemy: Java Programming for Complete Beginners – Learn in 250 StepsUdemy: Android Development from Scratch to Create Cool Apps! >>
Kids Hide Away