Chat freely about anything...

User avatar
By Stewart
#83119 I'm using time.h with tm_hour to get the hour of the day, but the time is in 12 Hr format by default.
I would like to use 24 Hour format (00-23 Hrs).

What is the simplest method to format a tm_hours (12Hr) value to %H hours?
I can not find an example. My code snippet is below.

Code: Select alltime_t now;
      struct tm * timeinfo;
      timeinfo = localtime(&now);
        if ((timeinfo->tm_hour)>= 22) // 10PM Event
            //Do something here


Any suggested syntax appreciated.