Write a program which takes the current time of the system clock, rounds to the nearest minute (you may choose how to round halves) and displays it formatted as the following:
A quarter past one in the morning. A quarter to two in the afternoon. Two o'clock in the afternoon. Twenty-five minutes to three in the morning. Twenty-seven minutes to seven in the evening. One minute past twelve in the afternoon. Twelve o'clock noon. Twelve o'clock midnight.
- 12:01am to 11:59am is deemed as morning.
- 12:01pm to 5:59pm is deemed as afternoon.
- 6:00pm to 11:59pm is deemed as evening.
- 15 minutes past the hour must be expressed as
A quarter pastthe hour
- 30 minutes past the hour must be expressed as
Half pastthe hour
- 45 minutes past the hour must be expressed as
A quarter tothe upcoming hour
- On-the-hour times must be expressed as the hour
o'clock, with the addition of noon and midnight being expressed with the addition of
- Other times in hh:01 to hh:29 must be expressed as (number of minutes)
- Other times in hh:31 to hh:59 must be expressed as (number of minutes)
tothe upcoming hour.
- Twenty-one to twenty-nine must be hyphenated.
- The first letter of the output must be capitalised. The other letters must be lower-case.
It would be useful to provide a testing version of your code so that it can be tested without manipulating the system clock.
Fifteen minutes past oneor
Fourty-five minutes past onefor the first two examples? \$\endgroup\$