Skip to main content

system.kanoa.utilities.secondsToText(secs, paramsDict)

Convert seconds into string i.e. '4 days 5Hrs 12 mins 44 secs'. paramsDict keys are optional


Parameters​

secs Integer: Seconds to convert
paramsDict Dictionary

- langStringLanguage support EN, ES, DE
- localeStringThe language for the units, from the installed translations, e.g. fr or pt-BR. If neither this nor lang is given, a Perspective session's own locale (session.props.locale); otherwise English
- roundUpBoolean: True if not provided. If True and showSecs is False, minutes will be shown as a whole number
- showDaysBooleanTrue if not provided
- showHrsBooleanTrue if not provided
- showMinsBooleanTrue if not provided
- showSecsBooleanTrue if not provided

Returns​

secondsString String


Example​

print system.kanoa.utilities.secondsToText(121, {})
>>> '2mins 1sec'
# French, with French installed (or a French session, without the locale key)
print system.kanoa.utilities.secondsToText(183845, {'locale': 'fr'})
>>> '2 jours 3 h 4 min 5 s'