Another way to do this is to use the Time library in the playground: Arduino Playground - Time
Here is the sketch above modifed to use this library
#include <LiquidCrystal.h> // lib. for LCD
#include <Time.h>
time_t elapsedTime;
//to restart the time counter to Zero: setTime(0);
LiquidCrystal lcd(7,8,9,10,11,12); // pins connected to LCD
void setup()
{
lcd.begin(20,4); // open the LCD
}
void loop()
{
elapsedTime = now();
lcd.setCursor(0,2); // sets cursor to 3rd line
lcd.print("Hour ");
lcd.print(hour(elapsedTime));
lcd.print(" ");
lcd.setCursor (0,3); // sets cursor to 4th line
lcd.print("DAYS "); // elapsed days
lcd.print(elapsedTime / SECS_PER_DAY);
lcd.setCursor (0,1); // sets cursor to 2nd line
lcd.print(minute(elapsedTime));
lcd.print(" min ");
lcd.setCursor(0,0); // sets cursor to 1st line
lcd.print(second(elapsedTime));
lcd.print(" SEC ");
}
Using the Time library has the advantage that it keeps correct time without having to compensate for delays in the loop code. You can also achieve this using the millis function but the Time library makes the sketch code simpler