TRUNC
Truncate a date. In Oracle mode, this function truncates a date value to a specified unit of measure.
Syntax
TRUNC(date[,fmt])Description
Examples
SELECT TRUNC('2025-09-24 12:43','DD');
+--------------------------------+
| TRUNC('2025-09-24 12:43','DD') |
+--------------------------------+
| 2025-09-24 00:00:00 |
+--------------------------------+
SELECT TRUNC('2025-09-24 12:43','MM');
+--------------------------------+
| TRUNC('2025-09-24 12:43','MM') |
+--------------------------------+
| 2025-09-01 00:00:00 |
+--------------------------------+
SELECT TRUNC('2025-09-24 12:43','YY');
+--------------------------------+
| TRUNC('2025-09-24 12:43','YY') |
+--------------------------------+
| 2025-01-01 00:00:00 |
+--------------------------------+Last updated
Was this helpful?

