Skip to main content

FROM_MICROSECOND

Description

The function converts a Unix timestamp (in microseconds) into a DATETIME value.

Syntax

FROM_MICROSECOND(<unix_timestamp>)

Parameters

ParameterDescription
<unix_timestamp>Required. The Unix timestamp representing the number of microseconds elapsed since 1970-01-01 00:00:00 UTC.

Return Value

  • Returns a DATETIME value representing the date and time corresponding to the given Unix timestamp.
  • If <unix_timestamp> is NULL, the function returns NULL.
  • If <unix_timestamp> is out of valid range, the function returns an error.

Example

SELECT FROM_MICROSECOND(1700000000000000);
+------------------------------------+
| from_microsecond(1700000000000000) |
+------------------------------------+
| 2023-11-15 06:13:20 |
+------------------------------------+