Question: language : java how to subtract two time objects using 24 hour system. for ex: subtract 14:00:00 from 09:03:07 where the difference is 04:57: 53.

language: java

how to subtract two time objects using 24 hour system. for ex: subtract 14:00:00 from 09:03:07 where the difference is 04:57: 53. show the result in console.

subtract 9:00:00 from 14:00:00 where different is -05:00:00. show result in console

hint: use modulus and while loop formatted like one below; hint: 24 hrs, 60 min, 60 sec

while(sec > 60) int tsec = sec %24; min -= sec / 24; this.sec = tsec;

while (min > 60) int tmin = min %24; ..... .... )

String string = hour + ":" + min +":" + sec;

system.out.println(string):

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!