tanakamasayuki / I2C_BM8563

Library to control I2C RTC
Creative Commons Zero v1.0 Universal
17 stars 4 forks source link

Setting Day of the Week #5

Closed anuradhawick closed 3 years ago

anuradhawick commented 3 years ago

Hi,

I am using M5Stick C Plus. I want to know how the date setting works.

Is Monday = 1 ? Is January = 1?

I assume the year and day of the month are set as they are.

Help is appreciated. Thanks

tanakamasayuki commented 3 years ago

Hi.

https://github.com/tanakamasayuki/I2C_BM8563/blob/master/examples/BM8563_SET_NTP/BM8563_SET_NTP.ino

  // Print RTC
  Serial.printf("%04d/%02d/%02d %02d:%02d:%02d\n",
                dateStruct.year,
                dateStruct.month,
                dateStruct.date,
                timeStruct.hours,
                timeStruct.minutes,
                timeStruct.seconds
               );

The numbers are the values that can be output.

2021-04-19(today) dateStruct.year = 2021 dateStruct.month = 4 dateStruct.date = 19

Week

https://lang-ship.com/blog/work/m5stickc-rtc-ntp/

  static const char *wd[7] = {"Sun","Mon","Tue","Wed","Thr","Fri","Sat"};
  M5.Lcd.printf("Week: %s\n", wd[RTC_DateStruct.WeekDay]);

Sun = 0

anuradhawick commented 3 years ago

Thanks! Much wanted help. Cheers.