You are viewing a single comment's thread. Return to all comments →
Scala-
` def timeConversion(s: String): String = { // Write your code here var hour = s.substring(0, 2).toInt val amPm = s.takeRight(2)
if (amPm == "AM") { if (hour == 12) hour = 0 } else if (amPm == "PM") { if (hour != 12) hour += 12 } f"`$hour%02d$`{s.substring(2, 8)}" }
`
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
Scala-
` def timeConversion(s: String): String = { // Write your code here var hour = s.substring(0, 2).toInt val amPm = s.takeRight(2)
`