User Tools

Site Tools


datetime

Date & Time

FeatureSupport
Sending
Receiving
Config

Supported Brands

None

Sender Arguments

None

Config

        "misc": {
                "name": "Misc",
                "date_and_time": {
			"name": "Date & Time",
			"protocol": [ "datetime" ],
			"id": [{
				"longitude": "4.895167",
				"latitude": "52.3702157",
				"ntpserver": "0.north-america.pool.ntp.org"
			}],
			"year": 2014,
			"month": 4,
			"day": 9,
			"hour": 21,
			"minute": 4,
			"second": 23
		}
        }

Optional Settings

SettingDefaultFormatDescription
gui-show-datetime11 or 0Don't display the datetime values
gui-datetime-formatHH:mm:ss YYYY-MM-DDsee belowDatetime formatting

Notes

The ntp-server id is optional. The ntp server will be used to check if the time is in sync with the atomic clock. When using pilight nightly, remove “” at the longtitude and latitude numbers. Also the latest nightly has an extra option: “weekday”. (weekday 1 = sunday)

Nightly example:

	"devices": {
                "date_and_time": {
                        "protocol": [ "datetime" ],
                        "id": [{
                                "longitude": 1.0407578,
                                "latitude": 7.4984056
                        }],
                        "year": 2015,
                        "month": 5,
                        "day": 28,
                        "hour": 0,
                        "minute": 26,
                        "second": 37,
                        "dst": 1,
                        "weekday": 4
                }
	},
	"gui": {
                "date_and_time": {
                        "name": "Date - Time",
                        "group": [ "Home" ],
                        "media": [ "all" ],
                        "format": "YYYY-MM-DD HH:mm:ss"
                }
	},
        "settings": {
                "ntp-servers": [ "0.nl.pool.ntp.org", "1.nl.pool.ntp.org" ]
        }

Formatting

InputOutput
M, MMMonth Number (1 - 12)
MMM, MMMMMonth Name (In currently language set by moment.lang())
D, DDDay of month
DDD, DDDDDay of year
d, dd, ddd, ddddDay of week (NOTE: these formats only make sense when combined with “ww”)
eDay of week (locale) (NOTE: these formats only make sense when combined with “ww”)
EDay of week (ISO) (NOTE: this format only make sense when combined with “WW”)
w, wwWeek of the year (NOTE: combine this format with “gg” or “gggg” instead of “YY” or “YYYY”)
W, WWWeek of the year (NOTE: combine this format with “GG” or “GGGG” instead of “YY” or “YYYY”)
YY2 digit year (if greater than 68 will return 1900's, otherwise 2000's)
YYYY4 digit year
gg2 digit week year (if greater than 68 will return 1900's, otherwise 2000's)
gggg4 digit week year
GG2 digit week year (ISO) (if greater than 68 will return 1900's, otherwise 2000's)
GGGG4 digit week year (ISO)
a, AAM/PM
H, HH24 hour time
h, hh12 hour time (use in conjunction with a or A)
m, mmMinutes
s, ssSeconds
SDeciseconds (1/10th of a second)
SSCentiseconds (1/100th of a second)
SSSMilliseconds (1/1000th of a second)
Z, ZZTimezone offset as +07:00 or +0700
XUnix timestamp
LT, L, LL, LLL, LLLLLocale dependent date and time representation

To use formatting in the nighly, use the option format in the GUI section of config.json.

Example Formatting Nightly:

                "date_and_time": {
                        "name": "Time",
                        "group": [ "Group" ],
                        "format": "HH:mm:ss"
                },

In this example, only the time is showed in the GUI (24h notation)

datetime.txt · Last modified: 2015/11/27 22:09 (external edit)