I can't adjust my RTC DS3231 date/time

Hello guys.
I'm using LCD and RTC DS3231

  • I've tried several different libraries.
  • I tried to adjust the date and time with the manual code.
  • I tried adjusting automatically with the compilation date and time
  • And yes I run the code it twice. (First without comment, then as comment on line that adjusts the date and time)
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <LiquidCrystal.h>     
#include <RTClib.h>

RTC_DS3231 rtc;

LiquidCrystal lcd(0,1,2,3,4,5);
int backlight = 6;
int backlightValor = 255;
int ldrPin = A0;  
int ldrValor = 0; 

void setup () {
  pinMode(backlight, OUTPUT);
  lcd.begin(16,2);              
  lcd.home();  
 
  if (! rtc.begin()) {
    //lcd.println("Couldn't find RTC");
    while (1);
  }

  if (rtc.lostPower()) {
 lcd.println("RTC lost power, lets set the time!");
 lcd.clear();
 delay(500);
    // following line sets the RTC to the date & time this sketch was compiled
    //rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop () {
 
    DateTime now = rtc.now();
 
    //ldrValor = analogRead(ldrPin);

    //backlightValor=255-(ldrValor/4);
    analogWrite(backlight, backlightValor);   
    
    lcd.setCursor(0,0);
 lcd.print(now.year());
    lcd.setCursor(4,0);     
    lcd.print("-");
 if(now.month() >= 0 && now.month()  < 10) 
 {
    lcd.setCursor(5,0);
 lcd.print("0");
 lcd.setCursor(6,0);
        lcd.print(now.month()); 
 }
 else
    {
    lcd.setCursor(5,0);
 lcd.print(now.month()); 
    }
    lcd.setCursor(7,0); 
    lcd.print("-"); 
 if(now.day() >= 0 && now.day()  < 10) 
 {
    lcd.setCursor(8,0);
 lcd.print("0");
 lcd.setCursor(9,0);
        lcd.print(now.day()); 
 }
 else
    {
    lcd.setCursor(8,0);
 lcd.print(now.day()); 
    } 
 if(now.hour() >= 0 && now.hour()  < 10) 
 {
    lcd.setCursor(0,1);
 lcd.print("0");
 lcd.setCursor(0,2);
        lcd.print(now.hour()); 
 }
 else
    {
    lcd.setCursor(0,1);
 lcd.print(now.hour()); 
    } 
    lcd.setCursor(2,1); 
    lcd.print(":"); 
 if(now.minute() >= 0 && now.minute()  < 10) 
 {
    lcd.setCursor(3,1);
 lcd.print("0");
 lcd.setCursor(3,2);
        lcd.print(now.minute()); 
 }
 else
    {
    lcd.setCursor(3,1);
 lcd.print(now.minute()); 
    }    
 lcd.setCursor(5,1); 
    lcd.print(":");    
 if(now.second() >= 0 && now.second()  < 10) 
 {
    lcd.setCursor(6,1);
 lcd.print("0");
 lcd.setCursor(6,2);
        lcd.print(now.second()); 
 }
 else
    {
    lcd.setCursor(6,1);
 lcd.print(now.second()); 
    } 
 delay(1000);
}

And that's what I get on LCD:

Please post the key details explaining the problem as text. Few people on this forum will open a mysteriously named website (link changed after I posted this comment, but message evidently not received).

Post a link to the site from which you downloaded the library associated with the code you posted, and the problem description.

Two programmes, one to set the time, the other to read it.
http://bildr.org/2011/03/ds1307-arduino/
works with DS3231