Date/Time Formatter
Write a Java program that is able to receive input in a particular given date pattern. The program will then parse
the input and print the requested output.
Input:
1. The first command line argument to the program is the input, provided by the user.
2. The second command line argument to the program is the date format/pattern, provided by the user.
Patterns can be provided using two ways:
1. Valid date patterns are specified here. See the Examples section of the above link for more info.
2. If a pattern begins with the letter “*”, convert and print the current time/date based on the Shamsi
calendar!
Output:
Program will then display the following values individually on the command prompt using the following format:
Year: <year>
Month: <month>
Month Name: <name-of-the-month>
Day: <day>
Day Name: <day-name>
Day of year: <what of the day of the year is this?
> Hour: <hour>
Minute: <minute>
Second: <second>
Exceptions:
The following exceptions should be thrown and caught by the program internally:
WayTooOldYearException: If the input year is less than 1900
PastUserBedTimeException: If the input time is greater than 10:55pm.
All other error conditions need to be accounted for and appropriate error messages must be displayed.
OOP:
Use OOP principals effectively, using the following rules:
1. Your program must contain a Main class that hosts the main() method.
2. You should provide different implementations and extensions of the public interface
IDateTimeFormatter, which includes the following and only method in its body:
DateTimeObject parseDateTime(final String value);
3. The DateTimeObject is a class that encapsulates the parsed input value in itself, and exposes various
methods for accessing the input year, month, hour, etc.