user76576: I have a DS3231 RTC module.
I would like to get the time from the RTC as 24 hour format not 12 hour. The library that I'm using requires that I pass in 2 Boolean values into Clock.getHour(), however changing these values does not change the returned time format.
Code;
/*
DS3231_test.pde
Eric Ayars
4/11

Test/demo of read routines for a DS3231 RTC.

Turn on the serial monitor after loading this to check if things are
working as they should.

*/

#include <DS3231.h>
#include <Wire.h>

DS3231 clock;
bool century = false;
bool h12Flag;
bool pmFlag;
byte alarmDay, alarmHour, alarmMinute, alarmSecond, alarmBits;
bool alarmDy, alarmH12Flag, alarmPmFlag;

void setup() {
    // Start the I2C interface
    Wire.begin();
 
    // Start the serial interface
    Serial.begin(57600);
}

void loop() {
    // send what's going on to the serial monitor.
    
    // Start with the year
    Serial.print("2");
    if (century) {          // Won't need this for 89 years.
        Serial.print("1");
    } else {
        Serial.print("0");
    }
    Serial.print(clock.getYear(), DEC);
    Serial.print(' ');
    
    // then the month
    Serial.print(clock.getMonth(century), DEC);
    Serial.print(" ");
  
    // then the date
    Serial.print(clock.getDate(), DEC);
    Serial.print(" ");
  
    // and the day of the week
    Serial.print(clock.getDoW(), DEC);
    Serial.print(" ");
  
    // Finally the hour, minute, and second
    Serial.print(clock.getHour(h12Flag, pmFlag), DEC);
    Serial.print(" ");
    Serial.print(clock.getMinute(), DEC);
    Serial.print(" ");
    Serial.print(clock.getSecond(), DEC);
 
    // Add AM/PM indicator
    if (h12Flag) {
        if (pmFlag) {
            Serial.print(" PM ");
        } else {
            Serial.print(" AM ");
        }
    } else {
        Serial.print(" 24h ");
    }
 
    // Display the temperature
    Serial.print("T=");
    Serial.print(clock.getTemperature(), 2);
  
    // Tell whether the time is (likely to be) valid
    if (clock.oscillatorCheck()) {
        Serial.print(" O+");
    } else {
        Serial.print(" O-");
    }
 
    // Indicate whether an alarm went off
    if (clock.checkIfAlarm(1)) {
        Serial.print(" A1!");
    }
 
    if (clock.checkIfAlarm(2)) {
        Serial.print(" A2!");
    }
 
    // New line on display
    Serial.println();
    
    // Display Alarm 1 information
    Serial.print("Alarm 1: ");
    clock.getA1Time(alarmDay, alarmHour, alarmMinute, alarmSecond, alarmBits, alarmDy, alarmH12Flag, alarmPmFlag);
    Serial.print(alarmDay, DEC);
    if (alarmDy) {
        Serial.print(" DoW");
    } else {
        Serial.print(" Date");
    }
    Serial.print(' ');
    Serial.print(alarmHour, DEC);
    Serial.print(' ');
    Serial.print(alarmMinute, DEC);
    Serial.print(' ');
    Serial.print(alarmSecond, DEC);
    Serial.print(' ');
    if (alarmH12Flag) {
        if (alarmPmFlag) {
            Serial.print("pm ");
        } else {
            Serial.print("am ");
        }
    }
    if (clock.checkAlarmEnabled(1)) {
        Serial.print("enabled");
    }
    Serial.println();
 
    // Display Alarm 2 information
    Serial.print("Alarm 2: ");
    clock.getA2Time(alarmDay, alarmHour, alarmMinute, alarmBits, alarmDy, alarmH12Flag, alarmPmFlag);
    Serial.print(alarmDay, DEC);
    if (alarmDy) {
        Serial.print(" DoW");
    } else {
        Serial.print(" Date");
    }
    Serial.print(" ");
    Serial.print(alarmHour, DEC);
    Serial.print(" ");
    Serial.print(alarmMinute, DEC);
    Serial.print(" ");
    if (alarmH12Flag) {
        if (alarmPmFlag) {
            Serial.print("pm");
        } else {
            Serial.print("am");
        }
    }
    if (clock.checkAlarmEnabled(2)) {
        Serial.print("enabled");
    }
 
    // display alarm bits
  Serial.println();
    Serial.print("Alarm bits: ");
    Serial.println(alarmBits, BIN);

    Serial.println();
    delay(1000);
}

How do I make this happen?

user70020: 
The library that I'm using requires that I pass in 2 Boolean values
into Clock.getHour(), however changing these values does not change
the returned time format.

You appear to be talking about the parameters here, which the second is for getting the current state of the AM/PM flag and configuration and not altering the kind of value you get in the return.
There's a setClockMode function you can call which will configure the chip to report in 24-hour mode.  If you call that passing in false, getHour should begin returning 24-hour time.

76576: <p>I have a DS3231 RTC module.</p>
<p>I would like to get the time from the RTC as 24 hour format not 12 hour. The library that I'm using requires that I pass in 2 Boolean values into <code>Clock.getHour()</code>, however changing these values does not change the returned time format.</p>
<p>Code;</p>
<pre><code>/*
DS3231_test.pde
Eric Ayars
4/11

Test/demo of read routines for a DS3231 RTC.

Turn on the serial monitor after loading this to check if things are
working as they should.

*/

#include &lt;DS3231.h&gt;
#include &lt;Wire.h&gt;

DS3231 clock;
bool century = false;
bool h12Flag;
bool pmFlag;
byte alarmDay, alarmHour, alarmMinute, alarmSecond, alarmBits;
bool alarmDy, alarmH12Flag, alarmPmFlag;

void setup() {
    // Start the I2C interface
    Wire.begin();
 
    // Start the serial interface
    Serial.begin(57600);
}

void loop() {
    // send what's going on to the serial monitor.
    
    // Start with the year
    Serial.print(&quot;2&quot;);
    if (century) {          // Won't need this for 89 years.
        Serial.print(&quot;1&quot;);
    } else {
        Serial.print(&quot;0&quot;);
    }
    Serial.print(clock.getYear(), DEC);
    Serial.print(' ');
    
    // then the month
    Serial.print(clock.getMonth(century), DEC);
    Serial.print(&quot; &quot;);
  
    // then the date
    Serial.print(clock.getDate(), DEC);
    Serial.print(&quot; &quot;);
  
    // and the day of the week
    Serial.print(clock.getDoW(), DEC);
    Serial.print(&quot; &quot;);
  
    // Finally the hour, minute, and second
    Serial.print(clock.getHour(h12Flag, pmFlag), DEC);
    Serial.print(&quot; &quot;);
    Serial.print(clock.getMinute(), DEC);
    Serial.print(&quot; &quot;);
    Serial.print(clock.getSecond(), DEC);
 
    // Add AM/PM indicator
    if (h12Flag) {
        if (pmFlag) {
            Serial.print(&quot; PM &quot;);
        } else {
            Serial.print(&quot; AM &quot;);
        }
    } else {
        Serial.print(&quot; 24h &quot;);
    }
 
    // Display the temperature
    Serial.print(&quot;T=&quot;);
    Serial.print(clock.getTemperature(), 2);
  
    // Tell whether the time is (likely to be) valid
    if (clock.oscillatorCheck()) {
        Serial.print(&quot; O+&quot;);
    } else {
        Serial.print(&quot; O-&quot;);
    }
 
    // Indicate whether an alarm went off
    if (clock.checkIfAlarm(1)) {
        Serial.print(&quot; A1!&quot;);
    }
 
    if (clock.checkIfAlarm(2)) {
        Serial.print(&quot; A2!&quot;);
    }
 
    // New line on display
    Serial.println();
    
    // Display Alarm 1 information
    Serial.print(&quot;Alarm 1: &quot;);
    clock.getA1Time(alarmDay, alarmHour, alarmMinute, alarmSecond, alarmBits, alarmDy, alarmH12Flag, alarmPmFlag);
    Serial.print(alarmDay, DEC);
    if (alarmDy) {
        Serial.print(&quot; DoW&quot;);
    } else {
        Serial.print(&quot; Date&quot;);
    }
    Serial.print(' ');
    Serial.print(alarmHour, DEC);
    Serial.print(' ');
    Serial.print(alarmMinute, DEC);
    Serial.print(' ');
    Serial.print(alarmSecond, DEC);
    Serial.print(' ');
    if (alarmH12Flag) {
        if (alarmPmFlag) {
            Serial.print(&quot;pm &quot;);
        } else {
            Serial.print(&quot;am &quot;);
        }
    }
    if (clock.checkAlarmEnabled(1)) {
        Serial.print(&quot;enabled&quot;);
    }
    Serial.println();
 
    // Display Alarm 2 information
    Serial.print(&quot;Alarm 2: &quot;);
    clock.getA2Time(alarmDay, alarmHour, alarmMinute, alarmBits, alarmDy, alarmH12Flag, alarmPmFlag);
    Serial.print(alarmDay, DEC);
    if (alarmDy) {
        Serial.print(&quot; DoW&quot;);
    } else {
        Serial.print(&quot; Date&quot;);
    }
    Serial.print(&quot; &quot;);
    Serial.print(alarmHour, DEC);
    Serial.print(&quot; &quot;);
    Serial.print(alarmMinute, DEC);
    Serial.print(&quot; &quot;);
    if (alarmH12Flag) {
        if (alarmPmFlag) {
            Serial.print(&quot;pm&quot;);
        } else {
            Serial.print(&quot;am&quot;);
        }
    }
    if (clock.checkAlarmEnabled(2)) {
        Serial.print(&quot;enabled&quot;);
    }
 
    // display alarm bits
  Serial.println();
    Serial.print(&quot;Alarm bits: &quot;);
    Serial.println(alarmBits, BIN);

    Serial.println();
    delay(1000);
}
</code></pre>
<p>How do I make this happen?</p>
 70020: <blockquote>
<p>The library that I'm using requires that I pass in 2 Boolean values
into Clock.getHour(), however changing these values does not change
the returned time format.</p>
</blockquote>
<p>You appear to be talking about the parameters <a href="https://github.com/NorthernWidget/DS3231/blob/v1.0.7/DS3231.h#L73" rel="nofollow noreferrer">here</a>, which the second is for getting the current state of the AM/PM flag and configuration and not altering the kind of value you get in the return.</p>
<p>There's a <a href="https://github.com/NorthernWidget/DS3231/blob/v1.0.7/DS3231.h#L102/DS3231.h#L106" rel="nofollow noreferrer">setClockMode function</a> you can call which will configure the chip to report in 24-hour mode.  If you call that passing in <code>false</code>, <code>getHour</code> should begin returning 24-hour time.</p>
