DATE::NOW 1g 2023 laplante@plcb.ca GOWEB/DATE


title: DATE::NOW section: 1g version: 1.0.0 date: 2023 author: laplante@plcb.ca

category: GOWEB/DATE

Name

date::now Return the current time and date.

SYNOPSIS

date::now or now([location: string, error: variable])

DESCRIPTION

Returns the current time and date.
An optional location can be specified to get the time in a specific timezone.

LOCATION

Specifies the timezone for the returned date/time.

On Linux, available locations can be listed with:

awk '/^Z/ { print $2 }; /^L/ { print $3 }' /usr/share/zoneinfo/tzdata.zi

The output includes a list of valid timezone identifiers (e.g., America/Montreal, Europe/Paris, Asia/Tokyo).

EXAMPLES

res={{ t := now(); t; }}.
→ res=2023-10-23 16:54:53.074186 +0200 CEST m=+0.009438501.

res={{ t1 := now(); sleep("5s"); t2 := now(); t2-t1; }}.
→ res=5.001040792.+.

res={{ t1 := now(); jt1 := time_json(t1); t2 := t1-"1h"; jt2 := time_json(t2); jt1.hour-jt2.hour; }}.
→ res=1.

res={{
    t := date::now(error:err, location:"montreal");
    err; "-";
    t;
    t := date::now(error:err, location:"America/Montreal");
    err; "-";
    t;
}}.
→ res=time::now : invalid location montreal : unknown time zone montreal--2023-10-23 10:56:11.760428 -0400 EDT.

AUTHOR

laplante@plcb.ca

SEE ALSO

VERSION