But, What i need is ,I have to get the difference between two values of time like"01:00:00" and "01:20:00". Is it possible to directly subtract these values or i have to convert it into seconds and then only i can able to get the difference?
preethi Ayyappan wrote: . . . Is it possible to directly subtract these values . . . ?
You tell us. Write down on a sheet of paper how you would intend to subtract two times. Remember you can only subtract numbers; you cannot "subtract" strings.
Can you create a Time class and subtract hours minutes seconds, or can you only subtract seconds. When you work out how to do it on paper, you will see how to do it in code.
By the way: the names of your variables, h, h1 add temp are not at all informative. Imagine coming back to that code in 6 months are having to work out what "h" means.