decorative banner

Previous | Next               Table Of Contents > 8 Working with timestamps > 8.1 Generating timestamps

8.1 Generating timestamps


The gettimestamp command is used to generate the current timestamp in YYYYMMDDhhmmss format (Y=year, M=month, D=day, h=hour, m=minute, s=second). The generated timestamp is copied to the user variable. The predefined keywords incr and decr can be optionally used to generate timestamps for previous or future dates. The predefined keywords second, minute, hour, day, week, month, and year are used to specify the time interval to adjust, while the interval count specifies the number of such intervals.

The syntax is

gettimestamp <user variable> [, optional: <keywords: incr, decr>, <keywords: second, minute, hour, day, week, month, year>, <interval count>];

Some examples are

gettimestamp ~my_timestamp; #get current timestamp

gettimestamp ~my_timestamp, decr, month, 2; #get a timestamp that is 2 months old

gettimestamp ~my_timestamp, incr, day, 5; #get a timestamp that is 5 days in the future


Previous | Next