Date and time with DS1307

Hi there

I have a DS1307 connected up to my Arduino which is working great. I can read the time from it and write to it.

From the DS1307 I get the date and time. Does anyone know how to get which day it is? ie the DS1307 knows that today is the 13th but can it also tell me that today is a Thursday?

David

What library are you using to access the DS1307? I use RealTimeClockDS1307 GitHub - davidhbrown/RealTimeClockDS1307: Yet another DS1307 Real-Time Clock library for Arduino (obsolete) and it has a getDayOfWeek() to access the DAY register (3) on the DS1307. Most other libraries will probably have a similar function. Note that you need to set the DAY register correctly when setting the date & time. It is not a calculated value from the date but just a counter that counts from 1 to 7 and then resets back to one. This allows you to use what ever value you want (between 1 and 7) as the first day of the week.

Hi there

I am using the library from Ladyada - DS1307 RTC tutorial

But it does not seem to have that function.

David

djm2:
I am using the library from Ladyada - DS1307 RTC tutorial
But it does not seem to have that function.

For that library I think you use dayOfWeek()