Arduino Time Library - Quick Question

Alright, I'm making an LCD clock using a DS1307 micro controller. The clock works perfectly fine as is, but I would like to add a 12 hour functionality to it. I'm aware the command used to make this happen is "hourFormat12();" although I'm not exactly sure where to implement it into my code (as replacing the tm.hours makes it a constant 12 o'clock).

#include <LiquidCrystal.h>
#include <DS1307RTC.h>
#include <Time.h>
#include <Wire.h>
LiquidCrystal lcd(9, 10, 5, 8, 7, 6); //Change these pins in relation to your LCD (First pin = leftmost pin on LCD Screen)
const char *monthName[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
tmElements_t tm;
int twelve = hourFormat12();
void setup() {
Serial.begin(9600);
while (!Serial) ; // wait for serial
delay(200);
Serial.println("-------------------");
Serial.println("| Serial For Clock |");
Serial.println("-------------------");
lcd.setCursor(0, 0);
lcd.begin(16, 2);
bool parse=false;
bool config=false;
}
void loop() {
tmElements_t tm;
if (RTC.read(tm)) {
Serial.print("Time: ");
print2digits(tm.Hour);
Serial.write(':');
print2digits(tm.Minute);
Serial.write(':');
print2digits(tm.Second);
Serial.print(" Date: ");
Serial.print(tm.Day);
Serial.write('/');
Serial.print(tm.Month);
Serial.write('/');
Serial.print(tmYearToCalendar(tm.Year));
Serial.println();
}
else {
if (RTC.chipPresent())
{
Serial.println("The DS1307 is off.");
delay(9000); }
}
lcd.print("T: ");
lcd.print(tm.Hour);
lcd.print(":");
lcd.print(tm.Minute);
lcd.print(":");
lcd.print(tm.Second);
lcd.setCursor(0, 1);
lcd.print("D: ");
lcd.print(tm.Day);
lcd.print("/");
lcd.print(tm.Month);
lcd.print("/");
lcd.print(tmYearToCalendar(tm.Year));
delay(1000);
lcd.clear();
}
void print2digits(int number)
{
if (number >= 0 && number < 10)
{
Serial.write('0');
}
Serial.print(number);}
bool getTime(const char *str)
{
int Hour, Min, Sec;
if (sscanf(str, "%d:%d:%d", &Hour, &Min, &Sec) != 3) return false;
tm.Hour = Hour;
tm.Minute = Min;
tm.Second = Sec;
return true;
}
bool getDate(const char *str)
{
char Month[12];
int Day, Year;
uint8_t monthIndex;
if (sscanf(str, "%s %d %d", Month, &Day, &Year) != 3) return false;
for (monthIndex = 0; monthIndex < 12; monthIndex++)
{
if (strcmp(Month, monthName[monthIndex]) == 0) break;
}
if (monthIndex >= 12) return false;
tm.Day = Day;
tm.Month = monthIndex + 1;
tm.Year = CalendarYrToTm(Year);
return true;
}

Any help is greatly appreciated, I have looked through other help threads and across google; but most examples I found either wouldnt work with my current code or didn't explain the process clearly.

I'm aware the command used to make this happen is "hourFormat12();"

Where is this "command" defined?

That's the main problem I'm having, as according to the readme for the time library:

hourFormat12(); // the hour now in 12 hour format

But the issue is, if I am to declare it like any other variable; I'm just not sure exactly what the syntax would be. (I'm aware this is a basic question, but it's always things like this that I tend to fumble on)

But the issue is, if I am to declare it like any other variable; I'm just not sure exactly what the syntax would be.

You currently have code that gets the time in a struct. Replace that with calls to hour(), minute(), etc. to get the parts.

When you understand what they return, it should be pretty easy to understand how to call hourFormat12() instead of hour().

I've decided a more efficient way to do this without changing the majority of my code was some simple math:

if (tm.Hour > 12) {
tm.Hour-12;
}

This has worked so far, thank-you for your help.

if (tm.Hour > 12) {
    tm.Hour-12;
  }

That code does nothing; you're missing an assignment.

Yeah that was a mistake on my part, simply pasted the wrong thing. The corrected 12 hour format is as follows

if (tm.Hour>12){
lcd.print(tm.Hour-12);
} else {
lcd.print(tm.Hour);
}