Dave's Brain

Browse - Programming Tips - How can I get the current time in milliseconds?

Date: 2016apr8
Language: Java
Level: beginner
Keywords: millisecond, nanosecond, nanoseconds, seconds, thousandths

Q.  How can I get the current time in milliseconds?

A.

long now = System.currentTimeMillis();
This is the number of milliseconds since Jan 1, 1970. Handy for timing things.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.