nushell/docs/commands/str-to-datetime.md
JT bff81f24aa
Autogenerate missing docs (#3514)
* Autogenerate missing docs

* Update ansi.md

* Rename question mark command docs

* Delete empty?.md
2021-05-30 12:57:04 +12:00

1.1 KiB

str to-datetime

converts text into datetime

Usage

> str to-datetime ...args {flags} 

Parameters

  • ...args: optionally convert text into datetime by column paths

Flags

  • -h, --help: Display this help message
  • -z, --timezone : Specify timezone if the input is timestamp, like 'UTC/u' or 'LOCAL/l'
  • -o, --offset : Specify timezone by offset if the input is timestamp, like '+8', '-4', prior than timezone
  • -f, --format : Specify date and time formatting

Examples

Convert to datetime

> echo '16.11.1984 8:00 am +0000' | str to-datetime

Convert to datetime

> echo '2020-08-04T16:39:18+00:00' | str to-datetime

Convert to datetime using a custom format

> echo '20200904_163918+0000' | str to-datetime -f '%Y%m%d_%H%M%S%z'

Convert timestamp (no larger than 8e+12) to datetime using a specified timezone

> echo '1614434140' | str to-datetime -z 'UTC'

Convert timestamp (no larger than 8e+12) to datetime using a specified timezone offset (between -12 and 12)

> echo '1614434140' | str to-datetime -o '+9'