W3cubDocs

/Nushell

into duration for conversions

Convert value to duration.

Signature

> into duration {flags} ...rest

Flags

  • --unit, -u {string}: Unit to convert number into (will have an effect only with integer input)

Parameters

  • ...rest: for a data structure input, convert data at the given cell paths

Input/output types:

input output
duration duration
int duration
string duration
table table

Examples

Convert duration string to duration value

>'7min'|into duration
7min

Convert compound duration string to duration value

>'1day 2hr 3min 4sec'|into duration
1day2hr3min4sec

Convert table of duration strings to table of duration values

> [[value]; ['1sec'] ['2min'] ['3hr'] ['4day'] ['5wk']] |into durationvalue
╭───┬───────╮
# │ value │
├───┼───────┤
01sec
12min
23hr
34day
45wk
╰───┴───────╯

Convert duration to duration

>420sec|into duration
7min

Convert a number of ns to duration

>1_234_567|into duration
1ms234µs567ns

Convert a number of an arbitrary unit to duration

>1_234|into duration--unitms
1sec234ms

Notes

Max duration value is i64::MAX nanoseconds; max duration time unit is wk (weeks).

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