After getting my DS1307 working beautifully I put together a nice sketch (at least for me) to print out the temperature (from a 1-Wire DS18B20) and the date time (from Lady Ada DSRTC1307 breakout board) by toggling a switch to a serial enabled (by SparkFun serial backpack) 16x2 LCD. Everything works perfect right now, but I would like to change the time format to AM/PM instead of the 24Hrs format. I have looked at the RTClib.h and haven't found a method or functions for this. Maybe I'm not looking at the right place or something but I'm sure there should be a method or library where that should be already implemented. I have used methods/functions from many others around. Also feel free to use it as your heart desires.

Anyway, here's my code (sorry for the coding mess, it's been almost 10 years since I programmed again and it's a wip:

because I was getting an overloading error on the LCD.print() function not being able to test numeric values and print chars at the same time. Plus I took the time to pad the time elements with zeros if less than 10. Here's the final code I ended up with on the time function:

@odometer - actually, the proper way to do that is with an array of characters (which is what the Time library does, btw). I was originally considering posting that, but I decided that the Time library offers a whole lot more than just this one thing, so the OP might be better off with it in the long run.

kindly help me with one thing that is i m using RTClib which is so good but i want to adjust time with up down button is it possible if i use RTC.adjust(manul_set(date,time) in this format i mean i declare adjust style but with my own function please tell me because as far as i learned there is i hve to change the library to time.h and DS1307RTC.h to make a manual set but i think the adjust fuction will work like this please tell me

The adjust function will work. You need to create a DateTime object and set it to the correct time, then you can call adjust.

There are many different ways to do this, but the simplest way would be to get the current time with rtc.now().secondstime(), then add or subtr5act the correct number of seconds according to the up/down button press.

For instance, to increase the hour by 1, you would add 3600 seconds. To decrease the hour by 1 you would subtract 3600 seconds.

thank u very much for the help i m making it i have another question about clock and that is i m using ds1307 but sometime it reali blurr i mean reading suddenly stuck on 45:165:165 kind of so i decided to work with ds3231 but my question part1 is can i use ds1307 with only wire.h library is it possible and question part2 is; is ds3231 is best alternat of ds1307 or is it just my assumption because ds3231 works on wire.h only library so i liked it and have an relitivli easy way to set date and time with buttons please tell me thank u