Reputation: 2475
I cannot figure out how to tell if a Calendar
object was created with no milliseconds versus a Calendar object that was created with milliseconds that happens to have a value 0.
I need to distinguish between the time stamps
2018 04 30 13:44:55 -0500
and
2018 04 30 13:44:55.000 -0500
The latter shows that the time clock is reporting time with a resolution to milliseconds while the former is only reporting time with a resolution to seconds. So in the latter case I want to display the '000' but in the former I do not.
Calendar.get(Calendar.MILLISECONDS) = 0
clearly does not solve this problem. Any ideas on how to do this?
Upvotes: 2
Views: 307
Reputation: 719446
The Calendar::isSet(int)
method will test if a specific field has been set.
Upvotes: 2