MICROSECOND() Function in MySQL
Last Updated :
04 Dec, 2020
MICROSECOND() :
This function in MySQL is used to return the microsecond part for a specified time or date-time value. The range of microsecond value is from 0 to 999999. For example, if the specified time is “09:12:23.000123”, this function will return 123 microseconds.
Syntax :
MICROSECOND(datetime)
Parameter :
This method accepts a parameter as given below:
- datetime – Specified time or date-time value to extract the microsecond from.
Returns :
It returns the microsecond part for a specified time or date-time value.
Example-1 :
Getting the microsecond “222” from the specified date and time “2020-11-24 09:32:12.000222” as follows.
SELECT MICROSECOND("2020-11-24 09:32:12.000222");
Output :
222
Example-2 :
Getting the microsecond “123456” from the specified time “06:12:23.123456” as follows.
SELECT MICROSECOND("06:12:23.123456");
Output :
123456
Example-3 :
Getting the microsecond “999999” from the specified time “838:9:19.999999” as follows.
SELECT MICROSECOND("838:9:19.999999");
Output :
999999
Example-4 :
Getting the microsecond “900000” from the specified time “1:2:7.9” as follows.
SELECT MICROSECOND("1:2:7.9");
Output :
900000
Example-5 :
Getting the microsecond “70000” from the specified time “16:24:0.070” as follows.
SELECT MICROSECOND("16:24:0.070");
Output :
70000
Example-6 :
Getting the microsecond “23″ from the specified time “12:32:52.000023” as follows.
SELECT MICROSECOND("12:32:52.000023");
Output :
23
Application :
This function is used to return the microsecond part for a specified time or date-time value.
Share your thoughts in the comments
Please Login to comment...