Day of week and RTC

HI, I am using the code RTC.adjust(DateTime(DATE,TIME)); to update my program from the PC to its time and date. However I would like to include day of the week. Is this possible as its shown on the task-bar at the bottom of the PC. I have looked for hours on the web and tried many variants but without success. Any help so gratefully received.

The function DateTime() should do that work for you. If you include the DATE you include already the day of the week, don't?

IIRC Day of the week is derived from the date and can therefore not be set ?

It’s an element called tm.Wday, Monday is 1.

It’s showing a “1” for me as we speak, and I’ve never set it explicitly so yep it must be derived.

Added a couple of lines to the DS1307RTC ReadTest sketch:

Serial.print(tm.Month);
Serial.write('/');
Serial.print(tmYearToCalendar(tm.Year));
Serial.write(" Weekday ");  //<<<<<<<<<<<<<<<<<<<<<<<<<
Serial.print(tm.Wday);       //<<<<<<<<<<<<<<<<<<<<<<<<<
Serial.println();

Is there an easy way to make a "1" show as "Mon" and "2" be "Tue" etc, without a whole bunch of if statements?

something like

char day[7][4] = {“Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”};

char c = ‘1’;

Serial.println( day[ c - ‘0’] );

I thought on the DS1307, Sunday is 1. That's how my code is set up.

Its up to the OS to interpret this field, in practive no-one uses it because its redundant. For a microcontroller it is useful though (since calculating the day of week from the date isn't trivial), just check whether the chip you use counts 0..6 or 1..7 and set it how you like, the RTC chips just increment every midnight. I was playing with the PCF2129 recently and that RTC uses 0..6, the datasheet for that series of RTCs says 0 = Sun, 1 = Mon etc.

ISO 8601 standard gives the weekday number, from 1 through 7, beginning with Monday and ending with Sunday.

The Day of Week register in the DS1307 can be set independently to any number you want from 1 to 7, and then happily cycles around with a midnight changeover.

Well the PCF2127/9 designers never read that standard I guess!