I need to get a date in normal style but at the end to print it with the very last millisecond in the day.
for example: 10/10/2012 --> 10/10/2012 23:59:59.999999
This is my code:
calendar = Calendar.getInstance();
calendar.setTime(givenDate);
calendar.add(Calendar.DATE, 1);
calendar.add(Calendar.MILLISECOND, -1);
Date convertedDate = calendar.getTime();
But I get the milliseconds wrong: 10/10/2012 23:59:59:000999
Help please.
A millisecond is 1/1000th of a second , not a millionth of a second. So the answer would be right, but it seems that your millisecond field is too long.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.