How i can to convert a string field ("HH:mm:ss") to time ("HH:mm:ss")?


Hello, please helpme.

In my database I have a string field with format HH:mm:ss and I need to change to a time field with format HH:mm:ss, that this field is displayed with the time format and that when exporting to a file excel keep the format.

I appreciate your help in advance.

r_suqui's picture
Joined: Nov 27 2014 - 11:37am
Last seen: 10 months 4 weeks ago

1 Answer:


You could just use the (old) SimpleDateFormat for that:

new SimpleDateFormat("hh:mm:ss").parse($F{YourTimeFieldAsString})

This should return a new java.util.Date with the parsed time but the 1.1.1970 (so the day/month/year are quite useless for your purpose).

Otherwise you could also use the "newer" Java LocalTime object... e.g.

hth + regards


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 3 weeks 2 days ago