Using formulas in scripts

Hello,
I would like to know whether it is possible to use some kind of formulas in the scripts? I am using a script in which I would like to convert a certain amount of time in seconds to a readable string such as “x minutes”/“x hours”/“x days”. I already have the script to convert this, but currently I need to do this 4 times and so I need to copy this 4 times. It would be much easier when I could put this in a formula.
So, is this possible?
Thanks!

In a Script you’re kind of limited to doing this sort of thing in a template, and each template is kind of its own “world.” You can’t easily share between templates, although there are some tricks that can work in some cases.

You might be better off doing what you want in a Python Script instead, if you’re comfortable with Python.

Thanks! I will try it with Python.