 // From http://stackoverflow.com/a/21235587
 String getDayOfTheWeek(int y, int m, int d) {
   String weekdayname[] = {"Sun", "Mon", "Tue",
-  "Wed", "Thu", "Fri", "Sat"};
-
-  int weekday = (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7;
-  
-  
+                          "Wed", "Thu", "Fri", "Sat"
+                         };
+
+  int weekday = (d += m < 3 ? y-- : y - 2, 23 * m / 9 + d + 4 + y / 4 - y / 100 + y / 400) % 7;
+
+
   return weekdayname[weekday];
 }
 
-String getMonth(int month){
-  switch(month){
+String getMonth(int month) {
+  switch (month) {
     case 1: return "Jan";
     case 2: return "Feb";
     case 3: return "Mar";
-    
+
     case 4: return "Apr";
     case 5: return "May";
     case 6: return "Jun";
-    
+
     case 7: return "Jul";
     case 8: return "Aug";
     case 9: return "Sep";
-    
+
     case 10: return "Oct";
     case 11: return "Nov";
     case 12: return "Dec";

  return result;
}

void printThisOnLCDLine(String text, int line){

  //Clear current line only if the new line cannot occupy the old line
  if(text.length() < LCD_CHAR_LENGTH){
    lcd.setCursor (0, line);  
    lcd.print("                "); 
  }

  lcd.setCursor (0, line);  
  lcd.print(text);
}

String generateDateTimeString(int year, int month, int day, int hour, int minute, int second){
  char buff[3];

  sprintf(buff, "%02d", hour);

#include <RTC_DS1307.h>

#include <LCD03.h>

#define BATT_PIN A3

#define LED_13_PIN 13

#define LDR_PIN A1

#define DHTPIN A0
#define DHTTYPE DHT22

#define LCD_CHAR_LENGTH 16

