In this guide, we will explain 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 is:
MICROSECOND( date_value )
Parameters or Arguments
date_value
The time or datetime value from which the microseconds are extracted from.
Note
- The MICROSECOND function returns the microsecond portion (a number from 0 to 999999) given a date value.
- See also the EXTRACT, YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, and SECOND functions.
Applies To
The MICROSECOND function can be used in the following versions :
- 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 MICROSECOND function examples and explore how to use the MICROSECOND function.
For example:
mysql> SELECT MICROSECOND('2014-01-28 15:21:05.000001'); Result: 1 mysql> SELECT MICROSECOND('2014-01-28 15:21:05.999999'); Result: 999999 mysql> SELECT MICROSECOND('2014-02-15'); Result: 0 mysql> SELECT MICROSECOND('12:13:06.387483'); Result: 387483 mysql> SELECT MICROSECOND('838:11:59.000013'); Result: 13
Next Topic : Click Here
Pingback: MySQL: MAKETIME Function | Adglob Infosystem Pvt Ltd