Java: Get the maximum value of the year, month, week, date from the current date of a default calendar
3. Get Calendar Max Values
Write a Java program to get the maximum value of the year, month, week, and date from the current date of a default calendar.
Sample Solution:
Java Code:
Sample Output:
Current Date and Time:Tue Jun 20 14:10:20 IST 2017 Actual Maximum Year: 292278994 Actual Maximum Month: 11 Actual Maximum Week of Year: 52 Actual Maximum Date: 30
N.B.: The result may varry for your system date and time.
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to retrieve maximum values for year, month, day, and hour from a Calendar and display them sorted.
- Write a Java program to compute and display the maximum possible values for all Calendar fields from the current date.
- Write a Java program to compare maximum field values between two Calendar instances set to different dates.
- Write a Java program to display maximum values of week, date, and minute from a Calendar using getActualMaximum.
Go to:
PREV : Get Calendar Date Info.
NEXT : Get Calendar Min Values.
Java Code Editor:
Improve this sample solution and post your code through Disqus
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.