posted 10 years ago

You can do arithmetic operations in EL if I'm not mistaken. And ordinary arithmetic operations are what you need here. Milliseconds = number mod 1000, subtract milliseconds from number and divide it by 1000, seconds = number mod 60, subtract seconds from number and divide it by 60, and so on.

Brian Percival

Ranch Hand

Posts: 163

posted 10 years ago

This is what I got. Hope someone can clarify this is true. However it displays decimals. How do I coerce the values as integers ?

<c:set var="dursec" value="${(ep.duration - (ep.duration mod 1000))/1000}" />

<c:set var="durhr" value="${(dursec - (dursec mod 3600)) / 3600}" />

<c:set var="temp" value="${(dursec - (durhr *3600))}" />

<c:set var="durmin" value="${ (temp - (temp mod 60)) / 60 }" />

<c:set var="dursec" value="${dursec-durmin*60-durhr*60}" />

${durhr} ${durmin} ${dursec}

This is what I got. Hope someone can clarify this is true. However it displays decimals. How do I coerce the values as integers ?

Brian Percival

Ranch Hand

Posts: 163

posted 10 years ago

Paul and Bear, thanks for your responses.

I looked at the fmt, got the display fine, but I couldn't figure out how to convert a x.0 type number to just 0x.

Should I look at the pattern attribute more? I thought I looked..

I looked at the fmt, got the display fine, but I couldn't figure out how to convert a x.0 type number to just 0x.

Should I look at the pattern attribute more? I thought I looked..

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |