DateTime Parts struct, similar to struct tm in <time.h>, containing a calendar date and time broken down into its components, but more readable, include some useful getter methods.
More...
#include <DateTime.h>
|
const time_t | _ts |
|
const int | _tz |
|
const struct tm * | _tm |
|
DateTime Parts struct, similar to struct tm in <time.h>, containing a calendar date and time broken down into its components, but more readable, include some useful getter methods.
◆ format()
String DateTimeParts::format |
( |
const char * |
fmt | ) |
const |
Foramt current time to string representation.
- Parameters
-
fmt | format string for strftime |
- Returns
- String string representation of current time
◆ from() [1/2]
DateTimeParts DateTimeParts::from |
( |
const time_t |
timeSecs, |
|
|
const int |
timeZone = 0 |
|
) |
| |
|
static |
factory method for constructing DateTimeParts from timestamp and timezone.
- Parameters
-
timeSecs | timestamp in seconds since 1970 |
timeZone | timezone offset (-11,+13) |
- Returns
- DateTimeParts DateTimeParts object
◆ from() [2/2]
◆ getHours()
int DateTimeParts::getHours |
( |
| ) |
const |
|
inline |
Get hours since midnight (0-23)
- Returns
- int hours
◆ getMinutes()
int DateTimeParts::getMinutes |
( |
| ) |
const |
|
inline |
Get minutes after the hour (0-59)
- Returns
- int minutes
◆ getMonth()
int DateTimeParts::getMonth |
( |
| ) |
const |
|
inline |
Get months since January (0-11)
- Returns
- int month value
◆ getMonthDay()
int DateTimeParts::getMonthDay |
( |
| ) |
const |
|
inline |
Get day of the month (1-31)
- Returns
- int month day
◆ getSeconds()
int DateTimeParts::getSeconds |
( |
| ) |
const |
|
inline |
Get seconds after the minute (0-60)
- Returns
- int seconds
◆ getTime()
time_t DateTimeParts::getTime |
( |
| ) |
const |
|
inline |
Get internal timestamp, in seconds.
- Returns
- time_t timestamp, in seconds
◆ getTimeZone()
int DateTimeParts::getTimeZone |
( |
| ) |
const |
|
inline |
Get internal timezone offset.
- Returns
- int timezone offset
◆ getWeekDay()
int DateTimeParts::getWeekDay |
( |
| ) |
const |
|
inline |
Get days since Sunday (0-6)
- Returns
- int day of week
◆ getYear()
int DateTimeParts::getYear |
( |
| ) |
const |
|
inline |
Get the year (format: 19xx, 20xx)
- Returns
- int year value
◆ getYearDay()
int DateTimeParts::getYearDay |
( |
| ) |
const |
|
inline |
Get days since January 1 (0-365)
- Returns
- int day of year
◆ toString()
String DateTimeParts::toString |
( |
| ) |
const |
Get string representation of current time.
- Returns
- String string representation of current time
◆ _tm
const struct tm* DateTimeParts::_tm |
struct tm variable, internal
◆ _ts
const time_t DateTimeParts::_ts |
timestamp variable, internal
◆ _tz
const int DateTimeParts::_tz |
timezone variable, internal
The documentation for this struct was generated from the following files: