W3cubDocs

/Nushell

date to-timezone for date

Convert a date to a given time zone.

Signature

> date to-timezone {flags} (time zone)

Parameters

  • time zone: time zone description

Input/output types:

input output
datetime datetime
string datetime

Examples

Get the current date in UTC+05:00

>date now|date to-timezone'+0500'

Get the current local date

>date now|date to-timezonelocal

Get the current date in Hawaii

>date now|date to-timezoneUS/Hawaii

Get the current date in Hawaii

>"2020-10-10 10:00:00 +02:00"|date to-timezone"+0500"
Sat, 10Oct202013:00:00+0500 (2yearsago)

Get the current date in Hawaii, from a datetime object

>"2020-10-10 10:00:00 +02:00"|into datetime|date to-timezone"+0500"
Sat, 10Oct202013:00:00+0500 (2yearsago)

Notes

Use 'date list-timezone' to list all supported time zones.

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