DateTime.h
Go to the documentation of this file.
46 #define elapsedSecsToday(_time_) (_time_ % SECS_PER_DAY) // the number of seconds since last midnight
48 #define previousMidnight(_time_) ((_time_ / SECS_PER_DAY) * SECS_PER_DAY) // time at the start of the given day
50 #define nextMidnight(_time_) (previousMidnight(_time_) + SECS_PER_DAY) // time at the end of the given day
52 #define elapsedSecsThisWeek(_time_) (elapsedSecsToday(_time_) + (dayOfWeek(_time_) * SECS_PER_DAY))
206 static void fromUnixTime(time_t timep, uint8_t* psec, uint8_t* pmin, uint8_t* phour, uint8_t* pday, uint8_t* pwday,
211 static void fromUnixTime(time_t timep, int8_t* psec, int8_t* pmin, int8_t* phour, int8_t* pday, int8_t* pwday,
238 static void convertFromUnixTime(time_t timep, int8_t* psec, int8_t* pmin, int8_t* phour, int8_t* pday,
259 static time_t toUnixTime(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year);
274 static time_t convertToUnixTime(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month,
337 uint8_t calcWeek(uint8_t firstDay); //Helper function calculates week number based on firstDay of week
static time_t convertToUnixTime(uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year)
Convert from individual time components to Unix time.
Definition: DateTime.h:274
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:600
DateTime()
Instantiate an uninitialised date and time object.
Definition: DateTime.h:82
DateTime(time_t time)
Instantiate a date and time object from a Unix timestamp.
Definition: DateTime.h:89
Time< T > time(Unit unit, T value)
Helper function to create a Time and deduce the type.
Definition: NanoTime.h:429
String toShortTimeString(bool includeSeconds=false)
Get human readable time.
bool parseHttpDate(const String &httpDate)
Parse a HTTP full date and set time and date.
Definition: DateTime.h:142
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:115
static void fromUnixTime(time_t timep, int8_t *psec, int8_t *pmin, int8_t *phour, int8_t *pday, int8_t *pwday, int8_t *pmonth, int16_t *pyear)
Definition: DateTime.h:211
String format(const String &formatString)
Create string formatted with time and date placeholders.
Definition: DateTime.h:330
static void convertFromUnixTime(time_t timep, int8_t *psec, int8_t *pmin, int8_t *phour, int8_t *pday, int8_t *pwday, int8_t *pmonth, int16_t *pyear)
Convert from Unix time to individual time components.
Definition: DateTime.h:238
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.
bool fromHttpDate(const String &httpDate)
Parse a HTTP full date and set time and date.
String format(const char *formatString)
Create string formatted with time and date placeholders.