AceTime
1.7.3
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
7 #include "common/DateStrings.h"
10 using ace_common::printPad2To;
15 const uint8_t LocalDate::sDayOfWeek[12] = {
31 const uint8_t LocalDate::sDaysInMonth[12] = {
48 printer.print(F(
"<Invalid LocalDate>"));
53 printer.print(
year());
55 printPad2To(printer, mMonth,
'0');
57 printPad2To(printer, mDay,
'0');
66 if (strlen(dateString) < kDateStringLength) {
73 const char* s = dateString;
76 int16_t
year = (*s++ -
'0');
85 uint8_t
month = (*s++ -
'0');
92 uint8_t
day = (*s++ -
'0');
93 day = 10 *
day + (*s++ -
'0');
void printTo(Print &printer) const
Print LocalDate to 'printer' in ISO 8601 format, along with the day of week.
static LocalDate forError()
Factory method that returns a LocalDate which represents an error condition.
uint8_t month() const
Return the month with January=1, December=12.
uint8_t dayOfWeek() const
Calculate the day of week given the (year, month, day).
The date (year, month, day) representing the date without regards to time zone.
const char * dayOfWeekLongString(uint8_t dayOfWeek)
Return the short dayOfWeek name.
static LocalDate forDateStringChainable(const char *&dateString)
Variant of forDateString() that updates the pointer to the next unprocessed character.
static LocalDate forDateString(const char *dateString)
Factory method.
Class that translates a numeric month (1-12) or dayOfWeek (1-7) into a human readable string.
uint8_t day() const
Return the day of the month.
bool isError() const
Return true if any component indicates an error condition.
static LocalDate forComponents(int16_t year, uint8_t month, uint8_t day)
Factory method using separated year, month and day fields.
int16_t year() const
Return the full year instead of just the last 2 digits.