Mysql Microsecond Function

MySQL: MICROSECOND Function

This tutorial explains how to use the MySQL MICROSECOND function with syntax and examples.

Description

The MySQL MICROSECOND function returns the microsecond portion of a date value.

Syntax

The syntax for the MICROSECOND function in MySQL is:

MICROSECOND( date_value )

Parameters or Arguments

date_value

The time or datetime value from which the microseconds are extracted from.

Note

Applies To

The MICROSECOND function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let's look at some MySQL MICROSECOND function examples and explore how to use the MICROSECOND function in MySQL.

For example:

mysql> SELECT MICROSECOND('2014-01-28 15:21:05.000001');
Output: 1

mysql> SELECT MICROSECOND('2014-01-28 15:21:05.999999');
Output: 999999

mysql> SELECT MICROSECOND('2014-02-15');
Output: 0

mysql> SELECT MICROSECOND('12:13:06.387483');
Output: 387483

mysql> SELECT MICROSECOND('838:11:59.000013');
Output: 13