W3cubDocs

/Nushell

format duration for strings

Outputs duration with a specified unit of time.

Signature

> format duration {flags} (format value) ...rest

Parameters

  • format value: the unit in which to display the duration
  • ...rest: For a data structure input, format duration at the given cell paths

Input/output types:

input output
duration string
list<duration> list<string>
table table

Examples

Convert µs duration to the requested second duration as a string

>1000000µs|format durationsec
1sec

Convert durations to µs duration as strings

> [1sec2sec] |format durationµs
╭───┬────────────╮
01000000µs
12000000µs
╰───┴────────────╯

Convert duration to µs as a string if unit asked for was us

>1sec|format durationus
1000000µs

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/format_duration.html