Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frederik T 242 posts 373 karma points
    Mar 23, 2012 @ 09:59
    Frederik T
    0

    Convert seconds to minutes and hours etc?

    Quick question, is it possible to convert a number (which is essentially seconds) to minutes and/or hours? And if so, how?

    Thank you in advance.

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Mar 23, 2012 @ 10:05
    Chriztian Steinmeier
    0

    Hi Frederik,

    If you don't want to just do a manual calculation, I'd suggest looking into The FormatDateTime extension in umbraco.library - you should be able to something with that, I'd think.

    /Chriztian 

  • Frederik T 242 posts 373 karma points
    Mar 23, 2012 @ 10:10
    Frederik T
    0

    I looked, but there is nothing about seconds at all which is why i ended up here. But if there is nothing built in i will try and find a workaround.

  • Dan Okkels Brendstrup 101 posts 197 karma points
    Mar 28, 2012 @ 15:29
    Dan Okkels Brendstrup
    1

    Essentially you just divide by 60 to get minutes, and by 60 again to get hours. And round the number via floor(). If you want more "fancy" format such as "1 minute and 30 seconds" you could create a template like this one.

Please Sign in or register to post replies

Write your reply to:

Draft