
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to save time in milliseconds in MySQL?
To save time in milliseconds, we can use now(3) function because “milli 3” can be used for te same purpose. Firstly, I will create a table with the help of CREATE command −
mysql> CREATE table MilliSecondDemo -> ( -> MyTimeInMillSec datetime(3) -> ); Query OK, 0 rows affected (0.70 sec)
Inserting record into the table −
mysql> INSERT into MilliSecondDemo values(now(3)); Query OK, 1 row affected (0.98 sec)
Let us now view the table records −
mysql> SELECT * from MilliSecondDemo;
The following is the output
+-------------------------+ | MyTimeInMillSec | +-------------------------+ | 2018-10-08 15:19:50.202 | +-------------------------+ 1 row in set (0.00 sec)
- Related Articles
- How to Convert Milliseconds to Time in Excel?
- How to get current time in milliseconds in Python?
- How to get time in milliseconds using C++ on Linux?
- How to get Time in Milliseconds for the Given date and time in Java?
- Java Program to display computer time in milliseconds
- How to get time in milliseconds since the Unix epoch in JavaScript?
- Java Program to display date and time in Milliseconds
- Get time in milliseconds using Java Calendar
- Display entire date time with milliseconds in Java
- Computer elapsed time of an operation in milliseconds in Java
- Java Program to get Milliseconds between two time instants
- How to save JSON array to MySQL database?
- How to convert varchar “time” to real time in MySQL?
- How to use TIME type in MySQL?
- Set the milliseconds for a specified date according to universal time.

Advertisements