I have a String of the form "03:20:10,132" representing a time value. What is the simpliest way to add an arbitrary time value to it? I think it isn't a good choice to manually parse the string to identify which is hour, minute and second. Is there a faster method?
Hi, One way of solving your problem is that you can use the SimpleDateFormat calss to convert this String to a Date object. Then using this date object you can build/set a GregorianCalendar Object. And using the add function of this GregorianCalendar class you can add any number to any field, like hour minute or seconds. Just remember one thing, when you create date object by providing only the time details, date is defaulted to Jan 01 1970.
Hope this gives you some direction to work on.
to err is human, but the company policy doesn't allow it!