Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get System time in Milliseconds in android

Tags:

java

android

time

Want to get time in milliseconds in android Ex 19:57:21:522.How do i do this?Could not find any straight forward API's to do so.

like image 222
NitZRobotKoder Avatar asked Dec 16 '22 06:12

NitZRobotKoder


1 Answers

Try SimpleDateFormat

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

Use a pattern with a capital S

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
String currentDateandTime = sdf.format(new Date());
like image 172
Scary Wombat Avatar answered Dec 29 '22 09:12

Scary Wombat