dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Using MICROSECOND in MySQL

Developers often work with time in terms of hours, minutes and seconds. Learn how to break it down to the microsecond level.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


By default, developers work with time up to the level of seconds, i.e. HOURS, MINUTES and SECONDS. There could be instances in which we may want to work on the MICROSECOND level as well.

The example below illustrates the usage of MICROSECOND in TIME.

Query:

SELECT MICROSECOND(NOW(3));

Note: NOW takes an argument between 0 to 6 and the precision of the value is based on this argument.

Sample output:

+---------------------+
| MICROSECOND(NOW(3)) |
+---------------------+
|              176000 |
+---------------------+

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Thanks for your registration, follow us on our social networks to keep up-to-date