description |
---|
Converts the input expressions to the corresponding date. |
- in: The date is extracted from the timestamp.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE(TIMESTAMP '2022-05-17 19:15:00.000')
-- 2022-05-17
{% endcode %}
- numeric_expression: A Unix epoch timestamp.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE(1640131200)
-- 2021-12-22
{% endcode %}
- numeric_expression: A Unix epoch timestamp.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE(1665131223.69)
-- 2022-10-07
{% endcode %}
- numeric_expression: A Unix epoch timestamp.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE(1640131200)
-- 2021-12-22
{% endcode %}
- string_expression: The string from which to extract the date.
- format: String to specify format of the date.
- replaceErrorWithNull: If 0, the function will fail when given malformed input. If 1, the function will return NULL when given the malformed input.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE('2022-07-22.23', 'YYYY-MM-DD', 1)
-- NULL
{% endcode %}
- string_expression: String from which to extract the date.
- format: String to specify format of the date.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE('05/24/22', 'MM/DD/YY')
-- 2022-05-24
{% endcode %}
- numeric_expression: A Unix epoch timestamp.
Examples
{% code title="TO_DATE example" %}
SELECT TO_DATE(1665131223.69)
-- 2022-10-07
{% endcode %}