Given a date, you have to print the day of the week.
Input : 2018 3 26 Output : Mon Input : 2010 8 9 Output : Wed
The idea is to use java built-in API Gregorian Calendar.
GregorianCalendar is a concrete subclass of Calendar and provides
the standard calendar system used by most of the world.
GregorianCalendar(int year, int month, int dayOfMonth) constructs a
GregorianCalendar with the given date set in the default time zone
with the default locale.
Several conditions are created to check the validity of
the input data. If an input is found to be wrong an Invalid
message will be printed as output.
- Change Gregorian Calendar to SimpleDateFormat in Java
- Print calendar for a given year in C++
- Calendar Functions in Python | Set 1( calendar(), month(), isleap()...)
- Calendar.before() method in Java
- Calendar.get() Method in Java
- java.util.Calendar.after() method
- Calendar set() Method in Java with Examples
- Calendar get() method in Java with Examples
- Calendar.equals() method in Java
- Calendar Class in Java with examples
- Calendar add() Method in Java with Examples
- Calendar getTime() Method in Java with Examples
- Calendar internalGet() Method in Java with Examples
- Calendar getMinimum() Method in Java with Examples
- Calendar getMinimalDaysInFirstWeek() Method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.