---
title: into datetime
categories: |
conversions
version: 0.104.0
conversions: |
Convert text or timestamp into a datetime.
usage: |
Convert text or timestamp into a datetime.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->
# `into datetime` for [conversions](/commands/categories/conversions.md)
<div class='command-title'>Convert text or timestamp into a datetime.</div>
## Signature
```> into datetime {flags} ...rest```
## Flags
- `--timezone, -z {string}`: Specify timezone if the input is a Unix timestamp. Valid options: 'UTC' ('u') or 'LOCAL' ('l')
- `--offset, -o {int}`: Specify timezone by offset from UTC if the input is a Unix timestamp, like '+8', '-4'
- `--format, -f {string}`: Specify expected format of INPUT string to parse to datetime. Use --list to see options
- `--list, -l`: Show all possible variables for use in --format flag
## Parameters
- `...rest`: For a data structure input, convert data at the given cell paths.
## Input/output types:
| input | output |
| ------------ | -------------- |
| any | table |
| datetime | datetime |
| int | datetime |
| list\<string\> | list\<datetime\> |
| nothing | table |
| record | any |
| string | datetime |
| table | table |
## Examples
Convert timestamp string to datetime with timezone offset
```nu
> '27.02.2021 1:55 pm +0000' | into datetime
Sat, 27 Feb 2021 13:55:00 +0000 (4 years ago)
```
Convert standard timestamp string to datetime with timezone offset
```nu
> '2021-02-27T13:55:40.2246+00:00' | into datetime
Sat, 27 Feb 2021 13:55:40 +0000 (4 years ago)
```
Convert non-standard timestamp string, with timezone offset, to datetime using a custom format
```nu
> '20210227_135540+0000' | into datetime --format '%Y%m%d_%H%M%S%z'
Sat, 27 Feb 2021 13:55:40 +0000 (4 years ago)
```
Convert non-standard timestamp string, without timezone offset, to datetime with custom formatting
```nu
> '16.11.1984 8:00 am' | into datetime --format '%d.%m.%Y %H:%M %P'
Fri, 16 Nov 1984 08:00:00 +0800 (40 years ago)
```
Convert nanosecond-precision unix timestamp to a datetime with offset from UTC
```nu
> 1614434140123456789 | into datetime --offset -5
Sat, 27 Feb 2021 13:55:40 +0000 (4 years ago)
```
Convert standard (seconds) unix timestamp to a UTC datetime
```nu
> 1614434140 | into datetime -f '%s'
Sat, 27 Feb 2021 13:55:40 +0000 (4 years ago)
```
Using a datetime as input simply returns the value
```nu
> 2021-02-27T13:55:40 | into datetime
Sat, 27 Feb 2021 13:55:40 +0000 (4 years ago)
```
Using a record as input
```nu
> {year: 2025, month: 3, day: 30, hour: 12, minute: 15, second: 59, timezone: '+02:00'} | into datetime
Sun, 30 Mar 2025 10:15:59 +0000 (a month ago)
```
Convert list of timestamps to datetimes
```nu
> ["2023-03-30 10:10:07 -05:00", "2023-05-05 13:43:49 -05:00", "2023-06-05 01:37:42 -05:00"] | into datetime
╭───┬─────────────╮
│ 0 │ 2 years ago │
│ 1 │ 2 years ago │
│ 2 │ 2 years ago │
╰───┴─────────────╯
```