In this section, you will learn to convert Time to
seconds. An hour has 3600 seconds and a minute has sixty seconds.
Description of program:
This example helps you in converting a Time to seconds. Here, first of all we
have changed Hours to minutes, minutes to seconds etc as shown below. We also
want that the Time would be displayed in the form of String so we have used a
TimetoStr constructor here and we have passed time to it. Therefore we get the
following output.
|
Output of the program:
| C:\unique>javac TimeToStr.java C:\unique>java TimeToStr 19:33:20 C:\unique> |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert Time to Seconds View All Comments
Post your Comment