DateTime.h
Go to the documentation of this file.
278 static bool fromISO8601(const String& datetime, time_t& time, uint16_t& milliseconds, int16_t& offsetMins);
340 static void fromUnixTime(time_t timep, uint8_t* psec, uint8_t* pmin, uint8_t* phour, uint8_t* pday, uint8_t* pwday,
DateTime(time_t time)
Instantiate a date and time object from a Unix timestamp.
Definition: DateTime.h:191
String toISO8601(const ZoneInfo *zone=nullptr) const
Get human readable date and time.
String format(const char *formatString, const ZoneInfo *zone=nullptr) const
Create string formatted with time and date placeholders.
static uint8_t getMonthDays(uint8_t month, uint16_t year)
static String getIsoMonthName(uint8_t month)
static String getIsoDayName(uint8_t day)
bool fromISO8601(const String &datetime, ZoneInfo *zone=nullptr)
Parse an ISO8601 date/time string.
static bool fromHttpDate(const String &httpDate, time_t &time)
Parse a HTTP full date string and return the time_t value.
static time_t toUnixTime(int sec, int min, int hour, int day, uint8_t month, uint16_t year)
Convert from individual time components to Unix time.
bool fromHttpDate(const String &httpDate)
Parse a HTTP full date and set time and date.
static bool fromISO8601(const String &datetime, time_t &time, uint16_t &milliseconds, int16_t &offsetMins)
Parse an ISO8601 date/time string and return discrete components.
String toShortTimeString(bool includeSeconds=false) const
Get human readable time.
static bool isLeapYear(uint16_t year)
void setTime(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year)
Set time using time and date component values.
Definition: DateTime.h:217
static void fromUnixTime(time_t timep, uint8_t *psec, uint8_t *pmin, uint8_t *phour, uint8_t *pday, uint8_t *pwday, uint8_t *pmonth, uint16_t *pyear)
Convert from Unix time to individual time components.
static String getLocaleMonthName(uint8_t month)
static String getLocaleDayName(uint8_t day)
String format(const String &formatString, const ZoneInfo *zone=nullptr) const
Create string formatted with time and date placeholders.
Definition: DateTime.h:414
static uint16_t getDaysInYear(uint16_t year)
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:609
Time< T > time(Unit unit, T value)
Helper function to create a Time and deduce the type.
Definition: NanoTime.h:432
Type for timezone abbreviation such as "GMT", "EEST".
Definition: DateTime.h:148
static Tag fromString(const char *s)
static Tag fromString(const char *s, size_t len)
Basic information required when displaying or handling local times.
Definition: DateTime.h:144
int16_t offsetMins
Offset from UTC in minutes.
Definition: DateTime.h:167
String getOffsetString(char sep) const
Return offset in ISO8601 string format, e.g. +11:00.
int offsetSecs() const
Get the offset in seconds so it can be added/subtracted directly from a time_t value.
Definition: DateTime.h:173
Tag tag
Abbreviation such as "GMT", "EEST" shown after time.
Definition: DateTime.h:166
1.9.1