Reputation: 566
How to format time in libgdx(java)?
long startTime = System.currentTimeMillis();
System.out.println(TimeUtils.timeSinceMillis(startTime));
I want to format like this:
min:sec:mil
00:00:00 or 00:00:000
Upvotes: 0
Views: 91
Reputation: 2409
Try like this;
long startTime = System.currentTimeMillis();
SimpleDateFormat sDate = new SimpleDateFormat("mm:ss.SSS");
System.out.println(sDate.format(startTime));
Output is;
05:42.331
If you want also with hour;
Format sDate = new SimpleDateFormat("HH:mm:ss.SSS");
Upvotes: 2