Challenge
Convert and print out a time in a 12-hour format. HH:MM AM/PM
Examples
Input:
'Fri Jun 30 2017 21:14:20 GMT-0700 (PDT)'
'Fri Jun 30 2017 00:10:23 GMT-0700 (PDT)'
'Fri Jun 30 2017 12:10:23 GMT-0700 (PDT)'
'Sat Jun 31 2018 8:06:20 GMT-0700 (PDT)'
'Fri Jul 01 2017 01:14:20 GMT-0700 (PDT)'
'Sat Apr 10 2020 09:06:20 GMT-0700 (PDT)'
Ouput:
9:14 PM
12:10 AM
12:10 PM
08:06 AM
1:14 AM
09:06 AM
Fine Points
A zero before a one digit number is okay, no zero is also allowed. The following examples are both allowed:
9:06 AM
09:06 AM
All tested years will be after
999
(each year will be exactly4
digits)
Rules
- This is code-golf so the shortest solution in bytes wins
- Standard Loopholes Apply
- You may use functions as well as programs
00:10:23 --> 12:10 AM
and12:10:23 --> 12:10 PM
. \$\endgroup\$'Fri Jun 30 2017 21:14:20 GMT-0400 (EDT)'
for me) \$\endgroup\$