Unable to enter two digit day in for date using DS3231 on 1602 LCD

I successfully followed a tutorial which used a DS3231, 1602 LCD, and buzzer to make a real time alarm clock, but wile trying to change different aspects of the code I accidently reset the date. Build into the code was a comment line, which when removing the “//” would set the date back to whichever date you enter there. I am able to set the date back, but only with a single digit day. (example 8/9/2018) I cannot make the current date 8/22/2018. It will not accept a variable past 9. I guess I could wait until the first, but I would much rather understand what is making it do this. Thank you for any help.

#include <DS3231.h>

#include <Wire.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

DS3231  rtc(SDA, SCL);

Time  t;

#define buz 11

int Hor;

int Min;

int Sec;




void setup()

{  

  Wire.begin();

  rtc.begin();

  Serial.begin(9600);

  pinMode(buz, OUTPUT);

  lcd.begin(16,2);     

  lcd.setCursor(0,0);

  lcd.print("DIYHacking.com");

  lcd.setCursor(0,1);

  lcd.print("Arduino Alarm ");

  // The following lines can be uncommented to set the date and time

  //rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY

  //rtc.setTime(12, 0, 0);     // Set the time to 12:00:00 (24hr format)

  rtc.setDate(8, 22, 2014);   // Set the date to August 8th, 2018

  delay(2000);

}




void loop()

{

  t = rtc.getTime();

  Hor = t.hour;

  Min = t.min;

  Sec = t.sec;

  lcd.setCursor(0,0);

  lcd.print("Time: ");

  lcd.print(rtc.getTimeStr());

 lcd.setCursor(0,1);

 lcd.print("Date: ");

 lcd.print(rtc.getDateStr());




 if( Hor == 11 &&  (Min == 32 || Min == 33)) //Comparing the current time with the Alarm time

{

Buzzer();

Buzzer();

lcd.clear();

lcd.print("Alarm ON");

lcd.setCursor(0,1);

lcd.print("Alarming");

Buzzer();

Buzzer();

} 

 delay(1000); 

}




void Buzzer()

{

digitalWrite(buz,HIGH);

delay(500);

digitalWrite(buz, LOW);

delay(500);

}

It would be more logical if setDate() had the date parameters order as d, m, y rather than m, d, y.

I am guessing that you are used to USA date formats?

lol yes and that's exactly what the issue was haha.. I just realized it a bit ago because it struck midnight and it changed what I thought was the month... but your right it displays dd/mm/yyyy…

know of any way I can change the format in order for it to display mm/dd/yyyy? or would that require me to change the included library?

Instead of using getDateStr() just build up the string from the d, m, y separately. You shouldn't need to use the library.