V
V
Volodar Znatsky2016-05-16 18:59:28
Java
Volodar Znatsky, 2016-05-16 18:59:28

How to find out the time in a format, not 12, but 24 hours?

This command gives the clock in 12 hour format.
hour=c.get(c.HOUR);
How to get the time in 24?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-05-16
@ja8mraz

The staff telepath suggested that c is Calendar .
You either need to use Calendar.HOUR_OF_DAY instead of Calendar.HOUR, or use Calendar.HOUR and Calendar.AM_PM in order to understand before or after 12 o'clock.
Accessing static fields through an instance is bad.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question