MySQL MICROSECOND() Function
In MySQL, the MICROSECOND()
function extracts the microsecond part of a time or datetime and return it as a number.
MICROSECOND()
Syntax
Here is the syntax of MySQL MICROSECOND()
function:
MICROSECOND(time)
Parameters
time
- Required. A date or datetime expression.
Return value
The MySQL MICROSECOND()
function extracts the microseconds part of a time or datetime and returns it as a number. The return value of MICROSECOND()
is a number between 0
and 999999
.
If the argument is NULL
, the MICROSECOND()
function will return NULL
.
MICROSECOND()
Examples
Here are some examples of the MICROSECOND()
function.
SELECT
MICROSECOND('10:11:12.000334'),
MICROSECOND('2022-02-28 10:11:12.000334'),
MICROSECOND('2022-02-28')\G
MICROSECOND('10:11:12.000334'): 334
MICROSECOND('2022-02-28 10:11:12.000334'): 334
MICROSECOND('2022-02-28'): 0