how to print time in 24 hr format

I have made a project to keep the record of temperature and time but while printing the records the time is not shown in proper way as in 24 hr format.
what i get is this
8/4/2015 15:57:09 24.9
8/4/2015 15:57:39 25.39
8/4/2015 15:58:09 25.39
8/4/2015 15:58:39 23.44
8/4/2015 15:59:09 24.9
8/4/2015 15:59:39 25.39
8/4/2015 10:00:09 24.9
8/4/2015 10:00:39 25.39
8/4/2015 10:01:09 25.39
8/4/2015 10:01:39 25.39
8/4/2015 10:02:09 25.39
8/4/2015 10:02:39 25.39
but i wanted it to be
8/4/2015 15:59:09 24.9
8/4/2015 15:59:39 25.39
8/4/2015 16:00:09 24.9
8/4/2015 16:00:39 25.39
.
Is it the problem because of hexadecimal number and decimal number?
how to solve this problem please help me.

upload.ino (1.62 KB)

Please provide the source for the DS3231.h library you are using. There are several with the same name.

8/4/2015 15:59:39 25.39
8/4/2015 10:00:09 24.9

In what universe does 15:59:39 roll around, seconds later, to 10:00:09?

The date may be reasonable. The time is not.

There are possible hardware defects in the lower four bits of the hours register which can give abnormal values, but this problem should be evident at more than the 5 to 6 (or 15 to 16) rollover.

Set your RTC to examine each hour boundary between midnight (00) and 10. Can you see any other anomalous values other than 5 going to 0 instead of 6. If you set the clock to look at the 6 to 7 roll over and the 7 to 8 rollover what do you see? Do the hours between 8 and 10 appear normally?

cattledog:
There are possible hardware defects in the lower four bits of the hours register...

I am guessing a software bug instead.

When the hours are set to 15, is that as binary 00001111, or is it as 00010101 ?

00001111 = the number fifteen in binary
00010101 = four bits (0001) meaning "one" followed by four bits (0101) meaning "five"

For the kind of RTC you are using, you want the latter (that is, bits 00010101 for hour 15).

Good catch, odometer.

I'll bet the RTC just checks to see if (hour > BCD 9) before setting the hour to zero and the 10 hour field to 1.

Library shopping on github can be risky.