DATETIME_TRUNC()

Overview

Returns a DATETIME with the fractional seconds truncated to the requested number of decimal places.

USAGE

DATETIME_TRUNC(timestamp, count)

Argument Name

Description

timestamp

The DATETIME value to modify

count

The number of digits desired after the decimal point

DETAILS

DATETIME_TRUNC() is a mathematical function that returns the timestamp truncated to count decimal places.

Note that truncated digits are replaced with trailing zeros.

A NULL is returned if either argument is NULL or the requested number of digits is not in the range 0-6.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT DATETIME_TRUNC('2022-04-01 12:34:56.123456', 2);
+-------------------------------------------------+
| DATETIME_TRUNC('2022-04-01 12:34:56.123456', 2) |
+-------------------------------------------------+
| 2022-04-01 12:34:56.120000                      |
+-------------------------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES