1 #include "common/util.h" 2 #include "common/DateStrings.h" 3 #include "LocalDateTime.h" 7 using common::printPad2;
8 using common::DateStrings;
12 printer.print(F(
"<Invalid LocalDateTime>"));
17 printer.print(mLocalDate.
year());
19 printPad2(printer, mLocalDate.
month());
21 printPad2(printer, mLocalDate.
day());
27 printPad2(printer, mLocalTime.
hour());
29 printPad2(printer, mLocalTime.
minute());
31 printPad2(printer, mLocalTime.
second());
35 printer.print(ds.weekDayLongString(
dayOfWeek()));
39 if (strlen(dateString) < kDateTimeStringLength) {
42 return forDateStringChainable(dateString);
46 LocalDateTime LocalDateTime::forDateStringChainable(
const char*& dateString) {
47 const char* s = dateString;
50 LocalDate ld = LocalDate::forDateStringChainable(s);
56 LocalTime lt = LocalTime::forTimeStringChainable(s);
The time (hour, minute, second) fields representing the time without regards to the day or the time z...
uint8_t month() const
Return the month with January=1, December=12.
bool isError() const
Return true if any component indicates an error condition.
static LocalDateTime forDateString(const char *dateString)
Factory method.
void printTo(Print &printer) const
Print LocalDateTime to 'printer' in ISO 8601 format.
int16_t year() const
Return the full year instead of just the last 2 digits.
uint8_t day() const
Return the day of the month.
static LocalDateTime forError()
Factory method that returns an instance where isError() returns true.
The date (year, month, day) representing the date without regards to time zone.
uint8_t hour() const
Return the hour.
uint8_t second() const
Return the second.
LocalDateTime()
Constructor.
uint8_t minute() const
Return the minute.
uint8_t dayOfWeek() const
Return the day of the week, Monday=1, Sunday=7 (per ISO 8601).