Get system time in milliseconds on android

Want to get the time in milliseconds in android Ex 19: 57: 21: 522 . How to do it? Could not find a direct API for this.

+4
source share
1 answer

Try SimpleDateFormat

http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Use capital template S

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); String currentDateandTime = sdf.format(new Date()); 
+12
source

Source: https://habr.com/ru/post/1502551/


All Articles