@ -499,26 +499,34 @@ There are built-in values to specify some standard date and time formats. For ex
Returns the current time in seconds since midnight Jan 1st 1970 in the timezone specified.
Returns the current time in seconds since midnight Jan 1st 1970 in the timezone specified.
`uint8_t hour(TIME)` < br >
`uint8_t hour(TIME)` < br >
`uint8_t hourFormat12(TIME)` < br >
`uint8_t minute(TIME)` < br >
`uint8_t minute(TIME)` < br >
`uint8_t second(TIME)`
`uint8_t second(TIME)` < br >
< br > `uint16_t ms(TIME)`
`uint16_t ms(TIME)` < br >
< br > `uint8_t day(TIME)`
`uint8_t day(TIME)` < br >
< br > `uint8_t weekday(TIME)`
`uint8_t weekday(TIME)` < br >
< br > `uint8_t month(TIME)`
`uint8_t month(TIME)` < br >
< br > `uint16_t year(TIME);`
`uint16_t year(TIME);`
These functions return the various elements of date or time for right now (no arguments) or for a given time in seconds sinds 1970. `weekday` returns a number starting with 1 for Sunday.
These functions return the various elements of date or time for right now (no arguments) or for a given time in seconds sinds 1970. `weekday` returns a number starting with 1 for Sunday. `hourFormat12` does hours from 1 to 12.
If you want to compare you can use the define s for names of days and months, like:
If you want to compare you can use compiler defines in all capital letter s for names of days and months, like:
```
```
if (UTC. weekday() == TUESDAY) Serial.print("Tuesday!!");
if (weekday() == TUESDAY) Serial.print("Tuesday!!");
```
```
```
```
if (UTC. month() == FEBRUARY & & UTC. day() == 14) Serial.print("Valentine's day!");
if (month() == FEBRUARY & & day() == 14) Serial.print("Valentine's day!");
```
```
`bool isAM(TIME)` < br >
`bool isPM(TIME)`
These will tell if it is before or after noon for a given `TIME` , return `true` or `false` .
### *weekISO and yearISO*
### *weekISO and yearISO*
`uint8_t weekISO(TIME)` < br > `uint16_t yearISO(TIME)` — Both assume default timezone if no timezone is prefixed
`uint8_t weekISO(TIME)` < br > `uint16_t yearISO(TIME)` — Both assume default timezone if no timezone is prefixed
@ -973,9 +981,9 @@ ezTime 0.7.2 runs fine (No networking on board, so tested with NoNetwork example
| [**`clearCache`** ](#clearcache ) | `void` | `bool delete_section = false` | yes | yes | NVS
| [**`clearCache`** ](#clearcache ) | `void` | `bool delete_section = false` | yes | yes | NVS
| [**`clearCache`** ](#clearcache ) | `void` | | yes | yes | EEPROM
| [**`clearCache`** ](#clearcache ) | `void` | | yes | yes | EEPROM
| [**`compileTime`** ](#compiletime ) | `time_t` | `String compile_date = __DATE__` , `String compile_time = __TIME__` | no | no | no
| [**`compileTime`** ](#compiletime ) | `time_t` | `String compile_date = __DATE__` , `String compile_time = __TIME__` | no | no | no
| [**`dateTime`** ](#datetime ) | `String` | `TIME` , `String format = DEFAULT_TIMEFORMAT` | optional | yes | no
| [**`dateTime`** ](#datetime ) | `String` | `TIME` , `String format = DEFAULT_TIMEFORMAT` | optional | no | no
| [**`day`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`day`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`dayOfYear`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME` | optional | yes | no
| [**`dayOfYear`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME` | optional | no | no
| [**`dayShortStr`** ](#names-of-days-and-months ) | `String` | `uint8_t day` | no | no | no
| [**`dayShortStr`** ](#names-of-days-and-months ) | `String` | `uint8_t day` | no | no | no
| [**`dayStr`** ](#names-of-days-and-months ) | `String` | `uint8_t day` | no | no | no
| [**`dayStr`** ](#names-of-days-and-months ) | `String` | `uint8_t day` | no | no | no
| [**`deleteEvent`** ](#deleteevent ) | `void` | `uint8_t event_handle` | no | no | no
| [**`deleteEvent`** ](#deleteevent ) | `void` | `uint8_t event_handle` | no | no | no
@ -983,50 +991,53 @@ ezTime 0.7.2 runs fine (No networking on board, so tested with NoNetwork example
| [**`error`** ](#error ) | `ezError_t` | `bool reset = false` | no | no | no
| [**`error`** ](#error ) | `ezError_t` | `bool reset = false` | no | no | no
| [**`errorString`** ](#errorstring ) | `String` | `ezError_t err = LAST_ERROR` | no | no | no
| [**`errorString`** ](#errorstring ) | `String` | `ezError_t err = LAST_ERROR` | no | no | no
| [**`events`** ](#events ) | `void` | | no | no | no
| [**`events`** ](#events ) | `void` | | no | no | no
| [**`getOffset`** ](#getoffset ) | `int16_t` | `TIME` | optional | yes | no
| [**`getOffset`** ](#getoffset ) | `int16_t` | `TIME` | optional | no | no
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| [**`getOlsen`** ](#getolsen ) | `String` | | optional | yes | yes |
| [**`getOlsen`** ](#getolsen ) | `String` | | optional | yes | yes |
| [**`getPosix`** ](#getposix ) | `String` | | yes | yes | no
| [**`getPosix`** ](#getposix ) | `String` | | yes | no | no
| [**`getTimezoneName`** ](#gettimezonename ) | `String` | `TIME` | optional | yes | no
| [**`getTimezoneName`** ](#gettimezonename ) | `String` | `TIME` | optional | no | no
| [**`hour`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`hour`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`isDST`** ](#isdst ) | `bool` | `TIME` | optional | yes | no
| [**`hourFormat12`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`isAM`** ](#time-and-date-as-numbers ) | `bool` | `TIME` | optional | no | no
| [**`isDST`** ](#isdst ) | `bool` | `TIME` | optional | no | no
| [**`isPM`** ](#time-and-date-as-numbers ) | `bool` | `TIME` | optional | no | no
| [**`makeOrdinalTime`** ](#makeordinaltime ) | `time_t` | `uint8_t hour` , `uint8_t minute` , `uint8_t second` , `uint8_t ordinal` , `uint8_t wday` , `uint8_t month` , `uint16_t year` | no | no | no
| [**`makeOrdinalTime`** ](#makeordinaltime ) | `time_t` | `uint8_t hour` , `uint8_t minute` , `uint8_t second` , `uint8_t ordinal` , `uint8_t wday` , `uint8_t month` , `uint16_t year` | no | no | no
| [**`makeTime`** ](#maketime ) | `time_t` | `tmElements_t &tm` | no | no | no
| [**`makeTime`** ](#maketime ) | `time_t` | `tmElements_t &tm` | no | no | no
| [**`makeTime`** ](#maketime ) | `time_t` | `uint8_t hour` , `uint8_t minute` , `uint8_t second` , `uint8_t day` , `uint8_t month` , `uint16_t year` | no | no | no
| [**`makeTime`** ](#maketime ) | `time_t` | `uint8_t hour` , `uint8_t minute` , `uint8_t second` , `uint8_t day` , `uint8_t month` , `uint16_t year` | no | no | no
| [**`militaryTZ`** ](#militarytz ) | `String` | `TIME` | optional | yes | no
| [**`militaryTZ`** ](#militarytz ) | `String` | `TIME` | optional | no | no
| [**`minute`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`minute`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`minuteChanged`** ](#secondchanged-and-minutechanged ) | `bool` | | no | no | no
| [**`minuteChanged`** ](#secondchanged-and-minutechanged ) | `bool` | | no | no | no
| [**`month`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`month`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| [**`monthShortStr`** ](#names-of-days-and-months ) | `String` | `uint8_t month` | no | no | no
| [**`monthShortStr`** ](#names-of-days-and-months ) | `String` | `uint8_t month` | no | no | no
| [**`monthStr`** ](#names-of-days-and-months ) | `String` | `uint8_t month` | no | no | no
| [**`monthStr`** ](#names-of-days-and-months ) | `String` | `uint8_t month` | no | no | no
| [**`ms`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME_NOW` or `LAST_READ` | optional | yes | no
| [**`ms`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME_NOW` or `LAST_READ` | optional | no | no
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| [**`now`** ](#time-and-date-as-numbers ) | `time_t` | | optional | no | no
| [**`now`** ](#time-and-date-as-numbers ) | `time_t` | | optional | yes | no
| [**`queryNTP`** ](#queryntp ) | `bool` | `String server` , `time_t &t` , `unsigned long &measured_at` | no | yes | no
| [**`queryNTP`** ](#queryntp ) | `bool` | `String server` , `time_t &t` , `unsigned long &measured_at` | no | yes | no
| [**`second`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`second`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`secondChanged`** ](#secondchanged-and-minutechanged ) | `bool` | | no | no | no
| [**`secondChanged`** ](#secondchanged-and-minutechanged ) | `bool` | | no | no | no
| [**`setCache`** ](#setcache ) | `bool` | `String name` , `String key` | yes | yes | NVS
| [**`setCache`** ](#setcache ) | `bool` | `String name` , `String key` | yes | yes | NVS
| [**`setCache`** ](#setcache ) | `bool` | `int16_t address` | yes | yes | EEPROM
| [**`setCache`** ](#setcache ) | `bool` | `int16_t address` | yes | yes | EEPROM
| [**`setDebug`** ](#setdebug ) | `void` | `ezDebugLevel_t level` | no | no | no
| [**`setDebug`** ](#setdebug ) | `void` | `ezDebugLevel_t level` | no | no | no
| [**`setDebug`** ](#setdebug ) | `void` | `ezDebugLevel_t level` , `Print &device` | no | no | no
| [**`setDebug`** ](#setdebug ) | `void` | `ezDebugLevel_t level` , `Print &device` | no | no | no
| [**`setDefault`** ](#setdefault ) | `void` | | yes | yes | no
| [**`setDefault`** ](#setdefault ) | `void` | | yes | no | no
| [**`setEvent`** ](#setevent ) | `uint8_t` | `void (*function)()` , `TIME` | optional | yes | no
| [**`setEvent`** ](#setevent ) | `uint8_t` | `void (*function)()` , `TIME` | optional | no | no
| [**`setEvent`** ](#setevent ) | `uint8_t` | `void (*function)()` , `uint8_t hr` , `uint8_t min` , `uint8_t sec` , `uint8_t day` , `uint8_t mnth` , `uint16_t yr` | optional | yes | no
| [**`setEvent`** ](#setevent ) | `uint8_t` | `void (*function)()` , `uint8_t hr` , `uint8_t min` , `uint8_t sec` , `uint8_t day` , `uint8_t mnth` , `uint16_t yr` | optional | no | no
| [**`setInterval`** ](#setserver-and-setinterval ) | `void` | `uint16_t seconds = 0` | | yes | no
| [**`setInterval`** ](#setserver-and-setinterval ) | `void` | `uint16_t seconds = 0` | | yes | no
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| [**`setLocation`** ](#setlocation ) | `bool` | `String location = ""` | yes | yes | no
| [**`setLocation`** ](#setlocation ) | `bool` | `String location = ""` | yes | yes | no
| [**`setPosix`** ](#setposix ) | `bool` | `String posix` | yes | yes | no
| [**`setPosix`** ](#setposix ) | `bool` | `String posix` | yes | yes | no
| [**`setServer`** ](#setserver-and-setinterval ) | `void` | `String ntp_server = NTP_SERVER` | no | yes | no
| [**`setServer`** ](#setserver-and-setinterval ) | `void` | `String ntp_server = NTP_SERVER` | no | yes | no
| **function** | **returns** | **arguments** | **TZ prefix** | **network** | **cache** |
| [**`setTime`** ](#settime ) | `void` | `time_t t` , `uint16_t ms = 0` | optional | yes | no
| [**`setTime`** ](#settime ) | `void` | `time_t t` , `uint16_t ms = 0` | optional | yes | no
| [**`setTime`** ](#settime ) | `void` | `uint8_t hr` , `uint8_t min` , `uint8_t sec` , `uint8_t day` , `uint8_t mnth` , `uint16_t yr` | optional | yes | no
| [**`setTime`** ](#settime ) | `void` | `uint8_t hr` , `uint8_t min` , `uint8_t sec` , `uint8_t day` , `uint8_t mnth` , `uint16_t yr` | optional | yes | no
| [**`timeStatus`** ](#timestatus ) | `timeStatus_t` | | no | no | no
| [**`timeStatus`** ](#timestatus ) | `timeStatus_t` | | no | no | no
| [**`tzTime`** ](#tztime ) | `time_t` | `TIME` | yes | yes | no
| [**`tzTime`** ](#tztime ) | `time_t` | `TIME` | yes | no | no
| [**`tzTime`** ](#tztime ) | `time_t` | `TIME` , `String &tzname` , `bool &is_dst` , `int16_t &offset` | yes | yes | no
| [**`tzTime`** ](#tztime ) | `time_t` | `TIME` , `String &tzname` , `bool &is_dst` , `int16_t &offset` | yes | no | no
| [**`updateNTP`** ](#updatentp ) | `void` | | no | yes | no
| [**`updateNTP`** ](#updatentp ) | `void` | | no | yes | no
| [**`urlEncode`** ](#urlencode ) | `String` | `String str` | no | no | no
| [**`urlEncode`** ](#urlencode ) | `String` | `String str` | no | no | no
| [**`waitForSync`** ](#waitforsync ) | `bool` | `uint16_t timeout = 0` | no | yes | no
| [**`waitForSync`** ](#waitforsync ) | `bool` | `uint16_t timeout = 0` | no | yes | no
| [**`weekISO`** ](#weekiso-and-yeariso ) | `uint8_t` | `TIME` | optional | yes | no
| [**`weekISO`** ](#weekiso-and-yeariso ) | `uint8_t` | `TIME` | optional | no | no
| [**`weekday`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | yes | no
| [**`weekday`** ](#time-and-date-as-numbers ) | `uint8_t` | `TIME` | optional | no | no
| [**`year`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME` | optional | yes | no
| [**`year`** ](#time-and-date-as-numbers ) | `uint16_t` | `TIME` | optional | no | no
| [**`yearISO`** ](#weekiso-and-yeariso ) | `uint16_t` | `TIME` | optional | yes | no
| [**`yearISO`** ](#weekiso-and-yeariso ) | `uint16_t` | `TIME` | optional | no | no
| [**`zeropad`** ](#zeropad ) | `String` | `uint32_t number` , `uint8_t length` | no | no | no
| [**`zeropad`** ](#zeropad ) | `String` | `uint32_t number` , `uint8_t length` | no | no | no