How to convert user input hours, minutes, seconds - both ways

In my model I have an attribute "duration" (seconds as an integer) But the views new/edit have input for: hours, minutes, seconds.

Should I have in model (attr_accessor :hours, :minutes, :seconds) then how do I convert these virtual attributes into my "duration" attribute, Coming from Java I'd have setter/getter on "duration"!