Function Repository Resource:

ReadableTimeString

Source Notebook

Convert raw seconds into a human-readable amount of time

Contributed by: Michael Sollami

ResourceFunction["ReadableTimeString"][seconds]

converts seconds into a human-readable time string.

Details and Options

ResourceFunction["ReadableTimeString"] takes the following options:
"Decimals"Automaticthe number of decimal places after the decimal point
NumberPoint"."the decimal point character, e.g. in South Africa you might use a comma
"PrefixShort"Trueuse short prefixes instead of long, e.g. "m" for "mega"
"ReturnQuantity"Falsewhether to return a Quantity object instead of a string
"Spacer"" "string that goes in between the number and unit
ResourceFunction["ReadableTimeString"] returns a String by default, unless option "ReturnQuantity" is set.
ResourceFunction["ReadableTimeString"] uses these unit symbols:
millisecond"ms"
second"s"
minute"m"
hour"h"
day"d"
week"w"
month"M"
year"Y"

Examples

Basic Examples (2) 

Convert seconds into a human-readable amount:

In[1]:=
ResourceFunction["ReadableTimeString"][18000]
Out[1]=

ReadableTimeString works on many time scales:

In[2]:=
ResourceFunction["ReadableTimeString"] /@ PowerRange[100000000]
Out[2]=

Options (2) 

Decimals (1) 

Return a rounded amount:

In[3]:=
ResourceFunction["ReadableTimeString"][61, "Decimals" -> 2]
Out[3]=

PrefixShort

In[4]:=
ResourceFunction["ReadableTimeString"][13274, "PrefixShort" -> False]
Out[4]=

ReturnQuantity (1) 

Return a Quantity object instead of a string:

In[5]:=
ResourceFunction["ReadableTimeString"][18000, "ReturnQuantity" -> True]
Out[5]=

Spacer

In[6]:=
ResourceFunction["ReadableTimeString"][13274, "Spacer" -> ""]
Out[6]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 20 January 2020

Related Resources

Author Notes

Still to be implemented:
QuadraticResidueAcousticDiffuser[]
QuadraticResidueAcousticDiffuser[{amin,amax}]
QuadraticResidueAcousticDiffuser[a,{bmin,bmax}]

License Information