This is my code:
long currentTime = System.currentTimeMillis(); Date date = new Date(currentTime); // if you really have long String result = new SimpleDateF
You can add milliseconds by adding SSS at the end, such as the format will be HH:mm:ss.SSS.
SSS
HH:mm:ss.SSS
There is no reference in the SimpleDateFormat to nanoseconds. Usually System.nanoTime() is used for performance debugging and not for display purposes.
SimpleDateFormat
System.nanoTime()