greenServeFE logogreenServeFELanguage, VM and Native Module Reference

Documentation home / Native Module API

Native Module API

Time and Date Formatting

Read the current Unix timestamp and format timestamps as local-time strings or UTC ISO-8601 strings.

Purpose

Read the current Unix timestamp and format timestamps as local-time strings or UTC ISO-8601 strings.

Exported API

ExportRole
nownow native function or exported value
formatformat native function or exported value
utcutc native function or exported value

Usage example

import gs_time;
define timestamp = gs_time.now();
print(timestamp);
print(gs_time.format(timestamp));
print(gs_time.utc(timestamp));
format accepts a timestamp and optional strftime-style format string. UTC formatting returns an ISO-8601 UTC timestamp.

Related documentation