HELP WITH 12 HR FORMAT

OK 1ST i am a father that doesn't really get "coding"
i am helping or trying to help my Austic stepson he is really focusing on building arduino things
and with the covid19 lock down it really keeps his mind focused
here is what we have so far Arduino Nano clone old bootloader
Rtc DS3231
16x2 lcd "not I2C " controlled the older kind with 16 raw header pins
and breadboard and wires
his mind only works in AM/PM 12 hour format his whole world is a schedual based on this time format als ois there a way to make the date read month / daY / YEAR?
he has had several meltdowns trying to figure this out and again im GREEN please offer help if you can
we are using the DS3231 _sereal-easy to load the time on the ds3231

#include <DS3231.h>

// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);

void setup()
{
// Setup Serial connection
Serial.begin(115200);
// Uncomment the next line if you are using an Arduino Leonardo
//while (!Serial) {}

// Initialize the rtc object
rtc.begin();

// The following lines can be uncommented to set the date and time
rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(18, 58, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(3, 5, 2020); // Set the date to January 1st, 2014
}

void loop()
{
// Send Day-of-Week
Serial.print(rtc.getDOWStr());
Serial.print(" ");

// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");

// Send time
Serial.println(rtc.getTimeStr());

// Wait one second before repeating :slight_smile:
delay (1000);
}

and this code to load and run the lcd

#include <DS3231.h>
#include <LiquidCrystal.h>

DS3231 rtc(SDA, SCL);
LiquidCrystal lcd(1, 2, 4, 5, 6, 7);
void setup() {
rtc.begin();
lcd.begin(16,2);

}
void loop() {
lcd.setCursor(0,0);
lcd.print("Time: ");
lcd.print(rtc.getTimeStr());

lcd.setCursor(0,1);
lcd.print("Date: ");
lcd.print(rtc.getDateStr());

delay(1000);
}

Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.
Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

In the future:
Use CTRL T to format your code.
Attach your ‘complete’ sketch between code tags, use the </> icon in the posting menu.

[code]Paste your sketch here[/code]

Do not use pin 1 as it is for serial communications.


Get libraries from the URLs as mentioned in the sketch.

// Version   YY/MM/DD   Comment
// 1.00      19/11/23   Running code


//********************************************************************************
//#define serialLCDisBeingUsed  //uncomment if you have a serial LCD   <-----<<<<<

#ifdef  serialLCDisBeingUsed

#include <Wire.h>

//Use I2C library:               https://github.com/duinoWitchery/hd44780
//LCD Reference:                 https://www.arduino.cc/en/Reference/LiquidCrystal

#include <hd44780.h>           //main hd44780 header

//NOTE:
//hd44780_I2Cexp control LCD using I2C I/O expander backpack (PCF8574 or MCP23008)
//hd44780_I2Clcd control LCD with native I2C interface (PCF2116, PCF2119x, etc...)

#include <hd44780ioClass/hd44780_I2Cexp.h> //I2C expander i/o class header

//If you do not know what your I2C address is, first run the 'I2C_Scanner' sketch
hd44780_I2Cexp lcd(0x3F);
//hd44780_I2Cexp lcd(0x27);

//********************************************************************************
#else
#include <LiquidCrystal.h>

//  N O T E : make sure these do not conflict with the pins used below

//               (04,06,11,12,13,14)    // <------<<<< LCD     Pin #s
//               (RS,EN,D4,D5,D6,D7)    // LCD pin names
LiquidCrystal lcd( 2, 3, 4, 5, 6, 7);   // <------<<<< Arduino Pin #s

#endif
//********************************************************************************

#include <DS3231.h>  //library is at:  https://github.com/NorthernWidget/DS3231
#include <Wire.h>

DS3231 Clock;

byte temp = 0;
bool Century = false;
bool h12;
bool PM;

//********************************************************************************
void setup()
{
  //Start the serial interface
  Serial.begin(9600);

  //this is a 16 by 2 LCD
  lcd.begin(16, 2);

  //Start the I2C interface
  Wire.begin();

  //Setting your RTC clock is a 3 step operation:
  //1. adjust the values below to reflect the current time
  //2. to set RTC time, change to 'false' to 'true' then upload this sketch
  //3. change back to 'false' then upload this sketch a second time
  if (false) //normally false
  {
    Clock.setClockMode(false); //false = 24h clock, true = 12h clock
    Clock.setYear(20);         //XX is the year 20XX
    Clock.setMonth(5);         //1-12
    Clock.setDate(4);          //1-32
    Clock.setDoW(2);           //1-7   1 = Sunday
    Clock.setHour(13);         //0-23
    Clock.setMinute(24);       //0-59
    Clock.setSecond(0);        //0-59
  }

} //END of setup()

//********************************************************************************
void loop()
{
  //*****************************  TITLE
  //            C  R
  lcd.setCursor(0, 0);
  //                   111111
  //         0123456789012345
  lcd.print("*** My Clock ***");

  //*****************************  MONTH
  //            C  R
  lcd.setCursor(0, 1);
  //                   111111
  //         0123456789012345
  //         mm dd   hh:mm:ss

  temp = Clock.getMonth(Century);

  printDigits(temp);

  //*****************************  Day
  //            C  R
  lcd.setCursor(3, 1);
  //                   111111
  //         0123456789012345
  //         mm dd   hh:mm:ss

  temp = Clock.getDate();

  printDigits(temp);

  //*****************************  HOUR
  //            C  R
  lcd.setCursor(8, 1);
  //                   111111
  //         0123456789012345
  //         mm dd   hh:mm:ss

  temp = Clock.getHour(h12, PM);

  if ( temp > 12)
  {
    temp = temp - 12;
  }

  printDigits(temp);

  lcd.print(':');

  //*****************************  MINUTE
  //            C  R
  lcd.setCursor(11, 1);
  //                   111111
  //         0123456789012345
  //         mm dd   hh:mm:ss

  temp = Clock.getMinute();

  printDigits(temp);

  lcd.print(':');

  //*****************************  SECOND
  //            C  R
  lcd.setCursor(14, 1);
  //                   111111
  //         0123456789012345
  //         mm dd   hh:mm:ss

  temp = Clock.getSecond();

  printDigits(temp);

  //*****************************  Serial Monitor
  //year
  Serial.print("20");
  Serial.print(Clock.getYear());
  Serial.print(' ');

  //month
  Serial.print(Clock.getMonth(Century));
  Serial.print(' ');

  //date
  Serial.print(Clock.getDate());
  Serial.print(' ');

  //day of the week
  Serial.print(Clock.getDoW());
  Serial.print(' ');

  //hour, minute, and second
  Serial.print(Clock.getHour(h12, PM));
  Serial.print(':');

  Serial.print(Clock.getMinute());
  Serial.print(':');

  Serial.println(Clock.getSecond());

  delay(1000);


} //END of loop()


//********************************************************************************
void printDigits(byte digits)
{
  if (digits < 10)
  {
    lcd.print('0');
  }

  lcd.print(digits);

} //END of   printDigits()

//********************************************************************************

use the Time library