Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Javascript 12 hours time to 24 hours---- what am i doing wrong? sample input 07:05:45PM sample output 19:05:45 function timeConversion(s) { let h1 let h2

Javascript 12 hours time to 24 hours---- what am i doing wrong?

sample input 07:05:45PM 

sample output

19:05:45 

function timeConversion(s) { let h1 let h2 = 0 let h3 if(s[8]==='A'){ if(parseInt(s[0]) === 0){ h1 = s[1]+s[2]+s[3]+s[4]+s[5]+s[6]+s[7]; }else h1 = s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+s[6]+s[7]; return h1 }else if(s[8]==='P'){ h2 = h2 +parseInt(s[1]) if(parseInt(s[0])===1){ h2 = 10 + h2 +12 }else{ h2 = 12+h2 } h3 = h2+s[2]+s[3]+s[4]+s[5]+s[6]+s[7] return h3 }else{ } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What do you like to do for fun/to relax?

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago

Question

How many states in India?

Answered: 1 week ago

Question

HOW IS MARKETING CHANGING WITH ARTIFITIAL INTELIGENCE

Answered: 1 week ago

Question

Develop a program for effectively managing diversity. page 317

Answered: 1 week ago