MySQL Date/Time microsecond() FunctionLast Updated : 13 Feb 2026 The microsecond() is a MySQL date/time function . It is used to get the value of microsecond from given datetime or time. It takes the date-time value as the input parameter and returns a integer value between 0 to 999999. Some of the functions of the microsecond function are given below:
In this article, we will understand the concept of MySQL Date/Time microsecond function in detail with its various working examples. SyntaxParameter:Date_value: datetime or time value for getting microsecond. Returns:This function returns the microsecond portion of a date value. Example 1Explanation: While executing the above query, the microsecond() function returns the microsecond value from the given date and time. Output: The output of this example is given below. ![]() Example 2Explanation: While executing the above query, the microsecond() function returns the microsecond from the given date and time. Output: The output of this example is given below. ![]() Using MySQL Date/Time microsecond function in a Table columnWe can use the MySQL DateTime microsecond() function in a table to return the microsecond from the table column. Following the steps below to perform the functionality of MySQL microsecond() function in a column of the table. Step 1: Create a table named Order_Details using the CREATE TABLE statement. Step 2: After that INSERT data into a table using the INSERT TABLE statement. Step 3: To check the information with the use of SELECT statement, whether the data is inserted or not.
Example:Explanation: On execution of the above statement, the microsecond function is used to retrieve the microseconds from the Order_Time column in the Order_Details table.
Using MySQL DateTime microsecond function in a Table with a WHERE ClauseWe can use the MySQL DateTime microsecond() function in a table to return the microsecond from the table column. By using the WHERE clause we can restrict the data. Sample Table: Order_Details
Example:Explanation: On execution of the above statement, the microsecond function is used to retrieve the microseconds from the Order_Time column in the Order_Details table WHERE the value of Amount column is greater than 500.
Next TopicMySQL datetime |
We request you to subscribe our newsletter for upcoming updates.