[SOLVED] How to set time on DS1307 using Time library?

bratan:
BTW I found this great and super simple code online that sets time just fine without any library:

While libraries are great because they simplify the mainline code, it's very much worthwhile to understand some of what's under the covers, in this case, using I2C to interface to the RTC chip directly. So if there is a problem, or a feature of the chip that the library doesn't implement, you can do it yourself. In the case of the DS1307RTC library, for example, it doesn't implement any methods to interface to the DS1307's static RAM.

Also note the layers of libraries here. DS1307RTC depends on both the Time library and the Wire library. The code from bildr only requires the Wire library. It could be taken one step further, and the ATmega328's registers could be manipulated directly to do the I2C communication, and then the Wire library could be eliminated.

Glad you got it working!