This is the ThingsDB documentation for version v0, click here for the latest version!

replace

Return a new datetime (or timeval) object with altered properties. The new properties must be given by a thing.

This function does not generate an event.

Function

datetime.replace(values)

Arguments

Argument Type Description
values thing (required) Only the properties year, month, day, hour, minute, second will be used, all other properties are simply ignored.

Return value

Returns a new datetime (or timeval) object.

Example

This code uses replace() as an example:

datetime('2020-12-10T16:08:24Z').replace({
    minute: 0,
    second: 0,
});

Return value in JSON format

"2020-12-10T16:00:00Z"