- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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)
Advertisements