java - SimpleDateFormat incorrectly parsing string -
string s = 19.17.38.008000; dateformat f = new simpledateformat("hh.mm.ss.ssssss"); date d = f.parse(s); system.out.println(d);
this code running runs fine except when prints prints time 19:17:46. please explain me
as side note:
string s = 19.17.38.008000; dateformat f = new simpledateformat("hh.mm.ss"); date d = f.parse(s); system.out.println(d);
this code print same string correctly minus milliseconds. please tell me missing here.
edit: answers think issue here reading 38.008000 .008 seconds sdf reading sss 8000 milliseconds not same thing.
ssssss
still milli-seconds if put 6 of them. 19:17:38 + 008000 ms 19:17:46 correct, if surprising.
afaik java.time
library in java 8 supports micro-second (and nano-second) timestamps.
thank @meno corrections.
Comments
Post a Comment