Displaying Time on 16x2 LCD

I know how to display text on LCDs, but I can't figure out how to display time. Can somebody give me the code for displaying time on an LCD or walk me through how to program it?

Mr Google would have returned a half dozen answers in the time it took to write your post...


And of course as you have cross posted your question has been answered here:


First of all, none of the google answers have helped. Second, I didn't get the answer on the other post. They told me to post it here by the way

It would be better here, as it is more of a programming question than a display question.

Can you do this without an RTC?

The only time that an Arduino can keep is milliseconds since it was switched on. It will not know what the real time is only the relative time since startup. So without a real time clock the only time you can get is how long since it was on. The code for displaying that is in the first LCD tutorial.

Thanks for the reply. Is there anyway to bypass using a RTC to get the actual time using the Arduino time library or something like that, or is it not possible?

What time is it that you are trying to get? And relative to what?

I'm just trying to get EST displayed on the LCD. I know that you usually need an RTC but I was wondering if you can create a clock without one.

You display time the same as you would any other variable data on the lcd. Show me how you display text on YOUR lcd and I'll show you how to print the time.

You can emulate a real time clock by updating a few variables locally, but as soon as your arduino loses power you'll have to reset the time. (most irritating)

For the sake of a few bob you can add a REAL time clock that will keep time even when your arduino isn't powered. Whenever you turn on your arduino it has the correct time. (assuming you've set it just once). Here's one

There IS an Additional consideration… The Uno uses a resonator, Not a crystal… It is no more accurate than +/- 5 -7 minutes/day…
Use the RTC.
Jack Christensen sells a Nice I2C RTC on Tindie using the Dallas DS3231 for ~$10.00
This chip has internal variable temperature compensation… The DS1307 (the most common RTC) doesn’t.
And the Arduino clock is an order of magnitude worse than the DS1307