RTC1307 - Set a custom date/time

Hello,

I'm using an RTC1307 module. The example in library included run well.
I would like to set a specific date, which is not the real date and time.

The following original code set the date/time as sketch compilation date/time.

How to modify to set custom date and time such as variables ?

RTC.adjust(DateTime(__DATE__, __TIME__));

Thanks,

Syn

RTC1307 Tutorial I used:

RTC1307 Library I used :

For you it might be easier to use the six argument constructor of DateTime:

DateTime::DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec)

Just insert the values you need.

I used this library
http://code.google.com/p/ds1307new/

//DS1307
#include <Wire.h>
#include <DS1307new.h>  // version 1.24

RTC.fillByYMD(year, month, day);
RTC.fillByHMS(hours, minutes, seconds);
RTC.setTime();
RTC.startClock();

You must declare and fill year,month,... etc. as int
Look at the examples also.

The instruction for Adafruit library is

RTC.adjust(DateTime(year, month, day, hour, minute, seconds))

I will try your solutions.
Thanks !!

From the gcc 'manual':

__DATE__This macro expands to a string constant that describes the date on which the preprocessor is being run. The string constant contains eleven characters and looks like "Feb 12 1996". If the day of the month is less than 10, it is padded with a space on the left.
If GCC cannot determine the current date, it will emit a warning message (once per compilation) and DATE will expand to "??? ?? ????".

__TIME__This macro expands to a string constant that describes the time at which the preprocessor is being run. The string constant contains eight characters and looks like "23:59:01".
If GCC cannot determine the current time, it will emit a warning message (once per compilation) and TIME will expand to "??:??:??".