Home Explore Blog CI



nushell

commands/docs/date_to-timezone.md
3f4b119ba47a10e61207eee74b9e9fa03011af77f3a72b730000000300000569
---
title: date to-timezone
categories: |
  date
version: 0.104.0
date: |
  Convert a date to a given time zone.
usage: |
  Convert a date to a given time zone.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `date to-timezone` for [date](/commands/categories/date.md)

<div class='command-title'>Convert a date to a given time zone.</div>

## 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.
```nu
> date now | date to-timezone '+0500'

```

Get the current date in the local time zone.
```nu
> date now | date to-timezone local

```

Get the current date in Hawaii.
```nu
> date now | date to-timezone US/Hawaii

```

Get a date in a different time zone, from a string.
```nu
> "2020-10-10 10:00:00 +02:00" | date to-timezone "+0500"
Sat, 10 Oct 2020 13:00:00 +0500 (4 years ago)
```

Get a date in a different time zone, from a datetime.
```nu
> "2020-10-10 10:00:00 +02:00" | into datetime | date to-timezone "+0500"
Sat, 10 Oct 2020 13:00:00 +0500 (4 years ago)
```

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

Chunks
505da9ca (1st chunk of `commands/docs/date_to-timezone.md`)
Title: date to-timezone: Convert Dates to Different Time Zones
Summary
The `date to-timezone` command in Nushell converts a given date (either datetime or string) to a specified time zone. It takes the time zone description as input and outputs the date in the new time zone. Examples demonstrate converting to UTC offsets, the local time zone, and specific locations like Hawaii. It also shows how to convert dates from strings or datetime objects.