char* ampms[]= {"am", "pm"};
void loop() // run over and over again
{ //get time from RTC
getDateDs1307(&second, &minute, &hour);
//change to 12 hour format.
if (hour>12) { hr = hour - 12; ampm=1; } else { hr = hour; }
//add leading 0 for hours
if (hr<10) { lcd.print("0"); }
//print hour in 12 hour format.
lcd.print(hr, DEC);
lcd.print(":");
//add leading 0 for minutes
if (minute<10) { lcd.print("0");}
//print minutes
lcd.print(minute, DEC);
//print am or pm using array.
dataFile.print(ampms[ampm]);
}
char* ampms[]= {"am", "pm"};
void loop() // run over and over again
{ //get time from RTC
getDateDs1307(&second, &minute, &hour);
//change to 12 hour format.
if (hour>12) { hr = hour - 12; ampm=1; } else { hr = hour; }
//add leading 0 for hours
if (hr<10) { lcd.print("0"); }
//print hour in 12 hour format.
lcd.print(hr, DEC);
lcd.print(":");
//add leading 0 for minutes
if (minute<10) { lcd.print("0");}
//print minutes
lcd.print(minute, DEC);
//print am or pm using array.
dataFile.print(ampms[ampm]);
}
void loop() // run over and over again
{ //get time from RTC
getDateDs1307(&second, &minute, &hour);
//change to 12 hour format.
if (hour>12) { hr = hour - 12; } else { hr = hour; }
//add leading 0 for hours
if (hr<10) { lcd.print("0"); }
//print hour in 12 hour format.
lcd.print(hr, DEC);
lcd.print(":");
//add leading 0 for minutes
if (minute<10) { lcd.print("0");}
//print minutes
lcd.print(minute, DEC);
//print am or pm using array.
if (hour>12) { lcd.print("am");} else {lcd.print("pm"); }
}
void loop() // run over and over again
{ //get time from RTC
getDateDs1307(&second, &minute, &hour);
//change to 12 hour format.
if (hour>12) { hr = hour - 12; } else { hr = hour; }
//add leading 0 for hours
if (hr<10) { lcd.print("0"); }
//print hour in 12 hour format.
lcd.print(hr, DEC);
lcd.print(":");
//add leading 0 for minutes
if (minute<10) { lcd.print("0");}
//print minutes
lcd.print(minute, DEC);
//print am or pm using array.
if (hour>12) { lcd.print("am");} else {lcd.print("pm"); }
}