How to convert string HH:MM to Joda Duration?
Posted
by
Lucas T
on Stack Overflow
See other posts from Stack Overflow
or by Lucas T
Published on 2011-01-06T20:52:28Z
Indexed on
2011/01/06
20:53 UTC
Read the original article
Hit count: 428
I have a field in a form to state the time duration of an event. Say, the event is to last 15 mins. So the field will have the following value: 00:15 If it is to last 1 hour: 01:00, etc.
How can I create a Joda Duration object with the string "HH:MM"?
Looking at Joda Time home page, it mentions that it is possible to create a Duration object from specified object using ConverterManager and DurationConverter respectively.
My question is, how can I implement the above interfaces so that I can create a Duration object by passing the a "4:30" parameter?
Thanks in advance,
Lucas
© Stack Overflow or respective owner