I'm trying to get a double value with seconds to convert to a custom time format. I've tried SimpleDate Format but that doesn't work...
I have a double value in this format: 407.33386569554585
(representing 407 seconds and 333 milliseconds ...).
I need that in this format: HH/MM/SS.MS
How would i do that?
Thanks in advance!
Terrestrial Time (TT) is a modern astronomical time standard defined by the International Astronomical Union, primarily for time-measurements of astronomical observations made from the surface of Earth.
var dateValue = new Date("2021-01-12 10:10:20"); Use new Date() along with setHours() and getHours() to add time.
Multiply by 1,000 then cast to a long
and construct a Date with it.
Date date = new Date((long)(dubTime*1000));
From here, you can use a SimpleDateFormat to make the string you'd like.
String formattedDate = new SimpleDateFormat("HH/mm/ss.SSS").format(date);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With