Skip to content

Commit 7cd725a

Browse files
committed
add errors task4
1 parent 5d11b8f commit 7cd725a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • Sprint-1/2-mandatory-errors

Sprint-1/2-mandatory-errors/4.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
const 12HourClockTime = "8:53pm";
22
const 24hourClockTime = "20:53";
3+
4+
// 12 Hour clock time is a string that represents the time in 12-hour format, while 24hourClockTime is a string that represents the time in 24-hour format.
5+
// To convert 12HourClockTime to 24-hour format, we can use the following steps:
6+
// 1. Split the string into hours and minutes using the split() method.
7+
// 2. Check if the time is in the "pm" period. If it is, add 12 to the hours (unless it's 12pm).
8+
// 3. If the time is in the "am" period and the hour is 12, set the hour to 0.
9+
// 4. Format the hours and minutes into a string in 24-hour format.

0 commit comments

Comments
 (0)