date_part

Gives one part of a timestamp in the app's timezone: "year", "month" (1 to 12), "day" (of the month), "hour" (0 to 23), "minute", "second", "weekday" (0 for Sunday to 6 for Saturday) or "yearday" (1 to 366). An unknown part gives null.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

date_part(timestamp, part)

Parameters:

Parameter Type Description
timestamp number the UNIX timestamp
part string the part wanted

Returned Value:

Type Description
number the part, as a number

Examples

if (date_part(now(), "weekday") == 0) { closed = true }