---
title: "Parse dates and timestamps in Strata | Oplema"
description: "Convert text or numbers to dates or timestamps with DateTime. Pick an input format such as a US or EU date and choose what happens to failed values."
url: "https://oplema.com/docs/strata/parse/datetime"
updated: "2026-11-04"
---

# DateTime

Convert text or numeric dates into dates or timestamps you can sort, filter and compare. Set the format yourself when day and month could be confused.

**Learn this in context:** [Convert text to numbers and dates, European format](https://oplema.com/learn/export-to-report/convert-numbers-and-dates) (Build a report from a CSV export)

## Parse dates

Manual Input has four rows with id and date\_text columns. DateTime reads date\_text as day/month/year and adds a DATE column named parsed\_datetime.

Result
| id | date\_text | parsed\_datetime |
| --- | --- | --- |
| 1 | 15/07/2026 | 2026-07-15 |
| 2 | 02/08/2026 | 2026-08-02 |
| 3 | pending |  |
| 4 |  |  |

1. Change Output as to `TIMESTAMP`. The two valid dates now include a time of midnight.
2. Change Output column to `date_text`. The parsed values replace the original text instead of adding a column.
3. Change If parse fails to `Fail`. The value `pending` causes an error.

## When to use

Use DateTime when dates are stored as text or numbers and you need to sort, filter or compare them. Set the format yourself when day and month could be confused.

## Read the output

The output keeps `id` and `date_text` and adds `parsed_datetime`. `15/07/2026` becomes `2026-07-15`, and `02/08/2026` becomes `2026-08-02`. Both are DATE values. The text `pending` and the missing value produce NULL. All four rows stay.

Choose the input format based on the source: `02/08/2026` means August 2 in EU date format but February 8 in US date format. A value can parse without an error and still be the wrong date.

With ISO selected, the first result is `2026-07-15T00:00:00`.

To generate the current date or time, use [Date/Time Now](https://oplema.com/docs/strata/io/date-time-now).

To infer column types automatically, use [Auto Field](https://oplema.com/docs/strata/prep/auto-field).

## Inputs and outputs

### Inputs

1 port

**In Required**

Accepts: Tables, Geospatial data.

Accepts one connection on this port.

### Outputs

1 port

**Out**

## Configure the block

Choose the source format, the output type and what should happen when a value can't be parsed.

**Column**

Choose the text or numeric column to parse. The first eligible column is selected automatically.

**Text looks like**

Choose the source format: EU date reads day/month/year, and US date reads month/day/year. Choose UNIX ms for milliseconds since the Unix epoch, or Custom for another layout.

**Pattern**

Shown for Custom. Enter a strptime pattern: %d/%m/%Y reads day/month/four-digit year.

**Output as**

Choose how parsed values are represented. UNIX: Milliseconds since the Unix epoch, stored as text. ISO: Date and time text formatted to seconds, without fractional seconds or a timezone suffix. DATE: A typed date without a time of day. TIME: A time of day in UTC, without a date. TIMESTAMP: A typed date and time. Date-only inputs use midnight. TIMESTAMP WITH TIME ZONE: Dates with times, stored in UTC. Default: TIMESTAMP.

**Output column**

Name the result column. Use the source column's name to replace it. Default: parsed\_datetime.

**If parse fails**

Null leaves an unparseable value missing while keeping its row. Fail reports an error instead. Default: Null.

## DateTime FAQs

**Does parsing remove rows?**

No. With Null selected, invalid values become NULL and all rows stay. Fail stops the block when a value can't be parsed.

**What happens to missing values?**

NULL input values stay NULL, including when If parse fails is set to Fail.

**Can the ISO preset read any ISO timestamp?**

The preset expects a layout such as 2026-07-15T15:14:06, with optional fractional seconds and a Z or numeric offset such as +02:00. Offsets are converted to UTC. For named time zones, choose a matching Custom pattern.

### Prepare your data. Build it in Strata.

Strata opens in your browser, with no account.

[Open Strata](https://oplema.com/editor?path=%2F%3Fopen%3Dstrata) [About Strata](https://oplema.com/strata)
