Express time duration as an attribute?

0
How would you express a non-date specific time duration? Say you were trying to recreate iTunes in Mendix (note: I am not trying to recreate iTunes in Mendix), how would you store/express the length of the track? It seems like it should be date/time, but there is no start time. Or should I just take the beginning of the current day (00:00:00) and add the 4 minutes and 3 seconds, and then just display the "time" of this morning at 00:04:03? It seems arduous to compute a decimal and then bring it back again for display. 
asked
2 answers
0

What about a long containing seconds (or milliseconds)?

If you want to format it as a time you could use the following:

formatDateTime(parseDateTime($duration + '','ss'),'mm:ss')

If $duration is set to 90, this will print 01:30.

answered
0

Hi Christopher

I think there are various ways to do this.  I would store the time (seconds or milliseconds) and then just to convert this into a string variable by calculating the mins and seconds from the milliseconds.  The idea would be to also store this string variable and display this instead.  I would put this calculation on the before commit just to confirm it gets calculated correctly everytime.

Gustav

answered