Gets the current day of week from RTC of PHPoC Shield for Arduino.
datetime.dayofWeek()
none
the current day of week - on success (1 ~ 7)
Return | Day of Week |
---|---|
1 | Monday |
2 | Tuesday |
3 | Wednesday |
4 | Thursday |
5 | Friday |
6 | Saturday |
7 | Sunday |
0 - on failure
#include <Phpoc.h>
PhpocDateTime datetime;
void setup() {
Serial.begin(9600);
while(!Serial)
;
// initialize PHPoC [WiFi] Shield:
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
Serial.println("Get year/month/day/dayofWeek/hour/minute/second from RTC in PHPoC Shield");
Serial.print(datetime.year());
Serial.print('-');
Serial.print(datetime.month());
Serial.print('-');
Serial.print(datetime.day());
Serial.print(' ');
Serial.print(datetime.dayofWeek());
Serial.print(' ');
Serial.print(datetime.hour());
Serial.print(':');
Serial.print(datetime.minute());
Serial.print(':');
Serial.print(datetime.second());
Serial.println();
// set date and time format:
datetime.date(F("Y-m-d H:i:s"));
}
void loop() {
Serial.println(datetime.date());
delay(10);
}