> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ETL: ToDateOrNull

> Parse a datetime string with a single format and return null for missing or unmatched values in Integrate.io ETL expressions and pipelines.

## Description

Parses an input string to a datetime value using the supplied format. Returns `null` when the input is null, empty, blank, or does not match the format, instead of failing the job.

Use `ToDateOrNull` when a column contains a mix of parseable and unparseable values and you want the bad rows to become `null` rather than stop the run. For a strict variant that throws on bad input, use [ToDate](/etl/todate). For multi-format fallback, use [ToDateCustomFormats](/etl/todatecustomformats).

## Syntax

`ToDateOrNull(dtStr, format)`

## Arguments

* *dtStr* - datetime value in a string expression.
* *format* - format of the input string. Uses the same Joda-Time pattern letters as [ToDate](/etl/todate).

## Examples

* `ToDateOrNull('2013-10-17 00:00:00', 'yyyy-MM-dd HH:mm:ss')` returns `2013-10-17T00:00:00.000Z`
* `ToDateOrNull('17/10/2013', 'dd/MM/yyyy')` returns `2013-10-17T00:00:00.000Z`
* `ToDateOrNull('31/02/2020', 'dd/MM/yyyy')` returns `null` (impossible calendar date)
* `ToDateOrNull('abc', 'dd/MM/yyyy')` returns `null`
* `ToDateOrNull('', 'dd/MM/yyyy')` returns `null`

## Return value datatype

datetime

## Impact of null value

If *dtStr* is null, empty, or whitespace only, returns null. If *format* is null or missing, an exception is thrown.
