I am have date object and getTime() will return only time in long in miliseconds but i want time in long in microseconds with consideration of timestampmicros concept . Is there any way for this type of conversion ? I am having timestamp value that i am getting from mysql DB . I just want microseconds precision from miliseconds Thanks in advance.
Asked
Active
Viewed 154 times
1 Answers
0
The java.util.Date
class is terrible and obsolete.
If you want the current moment with a resolution, call Instant.now()
and truncate the nanoseconds to microseconds.
Instant.now().truncatedTo( ChronoUnit.MICROSECONDS )

Basil Bourque
- 303,325
- 100
- 852
- 1,154