# Support Questions

Announcements
Celebrating as our community reaches 100,000 members! Thank you!

## Is there a way to convert seconds to HH:mm format?

New Contributor

I have a feed coming in with time spent value set in seconds. Example 900 or 3600

Is there way in nifi to convert attribute to 00:15 and 01:00 (HH:mm format)?

1 ACCEPTED SOLUTION
Guru

#### This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

3 REPLIES 3
Guru

#### This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Super Mentor

@GSB

If you wanted it always to be two digits, you would need to apply the same if/else NiFi Expression Language (NEL) logic the minute calculations in the working solution provided by @cotopaul

``\${value:divide(3600):lt(10):ifElse(\${value:divide(3600):prepend(0)},\${value:divide(3600)})}:\${value:divide(60):mod(60):lt(10):ifElse(\${value:divide(3600):mod(60):prepend(0)},\${value:divide(3600):mod(60)})}``

A simpler approach would be to use the toDate and Format NEL functions:

``\${value:toDate('sssss'):format('HH:mm')}``

I allow 5 's' assuming that max value would be 86,500 seconds (24 hours in a day) and does not matter if value is smaller.   This format also allows you to quickly and easily adjust format for example, maybe you don't want to truncate the remaining seconds and use ":format('HH:mm:ss')" instead.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

Community Manager

@GSB Have any of the replies helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.

Regards,

Vidya Sargur,
Community Manager