Skip to content

Get Date

Turns a date into formatted text and puts that text in the stash. Left alone it reads the server clock at the moment the op runs, which is what most rules want: a timestamp for a tag name, a release label, a file name or a log line. Fill the date in and the op becomes a reformatter, taking a date the rule already holds and rewriting it in another layout.

It does no arithmetic. There is no way to ask for "tomorrow" or "the first of next month" from this form, so date maths still belongs in CODE. For a fixed string that never changes, SET VAR is shorter.

Date field blank: server clock now a value: read as written not a date: op stops apply Date Format to get plain text Return Key set no Return Key stored in the stash thrown away

Fields

Date (or blank for CURRENT date)

The date to format. Blank means the date and time at the moment the op runs, read from the server clock in the server's own time zone. A literal 0 counts as blank too.

The field expands ${var} placeholders, so ${topic.start_date} or ${job.start} are the usual contents when you are reformatting rather than stamping.

What it understands:

You type Read as
2026-01-31 10:20:30 that date and time
2026-01-31T10:20:30 the same, ISO style
2026-01-31 that day at midnight
2026-1-3 the same, single digits are fine
20260131102030 year, month, day, hour, minute, second run together
1767000000 seconds since the epoch

Slash-separated input is not understood at all, even though the format list offers slash output. 2026/01/31 stops the op. Only the layouts in the table parse.

Day-first text is not understood either, and it fails quietly rather than loudly. 16-09-2026 comes back as 20 September 2016, because the leading number is taken for the year and the trailing digits are chopped to fit the day. 31-01-2026 comes back as 20 January 2031. Convert day-first input in CODE before it reaches this field.

The run-together form needs all fourteen digits. 20260131 on its own is eight digits, which is read as seconds since the epoch and comes back somewhere in 1970.

An out-of-range day rolls forward instead of failing: 2026-02-30 comes back as 2 March.

A time zone written into the value is ignored. 2026-01-31T10:20:30Z and 2026-01-31 10:20:30 +0200 both give 10:20:30 in the server's time zone, not the instant they describe. Anything after the seconds, milliseconds included, is dropped.

Text the op cannot read at all stops the op with a message naming the value.

Date Format

The layout of the text that comes out. The list holds nine ready-made entries, and the field is editable, so you can type any pattern you like.

Shown in the list Stored pattern
YYYY-MM-DD hh:mm:ss %Y-%m-%d %H:%M:%S
YYYY/MM/DD hh:mm:ss %Y/%m/%d %H:%M:%S
YYYY-MM-DDThh:mm:ss %Y-%m-%dT%H:%M:%S
DD-MM-YYYY hh:mm:ss %d-%m-%Y %H:%M:%S
DD/MM/YYYY hh:mm:ss %d/%m/%Y %H:%M:%S
YYYY-MM-DD %Y-%m-%d
YYYY/MM/DD %Y/%m/%d
DD-MM-YYYY %d-%m-%Y
DD/MM/YYYY %d/%m/%Y

The left column is only a label. What gets stored, and what the op works with, is the pattern on the right. Type YYYY-MM-DD into the field by hand and you get back the literal text YYYY-MM-DD, because nothing in it starts with a percent sign. That is the most common way to end up with a tag named YYYY-MM-DD.

A new op arrives with the first entry already selected, so the field is never empty unless you hand-edit the rule. When it is empty, %Y-%m-%d %H:%M:%S is used.

Pieces beyond the presets:

Piece Gives
%Y %y four-digit year, two-digit year
%m %d month and day, zero padded
%H %M %S hour (24h), minute, second
%I %p hour (12h), AM or PM
%a %A short and long weekday name
%b %B short and long month name
%j %V %u day of year, week number, weekday number
%Z %z time zone name, time zone offset
%s seconds since the epoch
%% a literal percent sign

Anything that is not a recognised piece passes through untouched, which is how %Y%m%d_%H%M%S produces 20260916_190152. Weekday and month names come out in the server's locale, so they are a poor choice for anything a rule later compares.

Where the result goes

The formatted text reaches the stash only through the Return Key field in the op's options. Leave it empty and the op computes a date, returns it, and nothing keeps it. That is the usual reason a later op sees an empty variable.

Setting Return Key to = is no use here. That shortcut merges a returned map into the stash, and this op returns a single piece of text, so you end up with a stash entry named =. Give it a normal name.

The value stored is text, not a date object. Comparisons in IF var condition THEN are text comparisons unless you tick Numeric, so pick a year-first pattern when you intend to compare or sort.

Failure and rollback passes

An unreadable date stops the op. Whether that stops the rule depends on the op's Error Handling setting: leave it at Throw Errors and the rule ends in error, set it to Ignore Errors and the rule carries on with nothing written to the Return Key.

The op has nothing to undo, but it does run a second time on a rollback pass unless you untick Run Rollback. A blank Date then reads the clock again and overwrites the value captured on the way forward, so a timestamp you meant to reuse in the rollback path becomes the rollback's own time.

Combining with other ops

Stamp the timestamp once and reuse it everywhere else in the rule. Feed it into Tag on Create a tag in a Git repository, into Branch Name on Create a branch in a Git repository, or into the message on LOG Message.

To build a longer string around the date, keep this op on the date itself and assemble the rest with SET VAR, which expands ${var} in its value.

When a rule should act only inside a window, format the current time with a year-first pattern and test it with IF var condition THEN.

Examples

A timestamp safe to use inside names, taken at the moment the rule runs.

Date (or blank for CURRENT date)   (blank)
Date Format                        %Y%m%d_%H%M%S
Return Key                         build_stamp

Reformat a date the rule already loaded into a day-first layout for a notification body.

Date (or blank for CURRENT date)   ${topic.start_date}
Date Format                        %d/%m/%Y %H:%M
Return Key                         start_pretty

Seconds since the epoch, for arithmetic in a later code block.

Date (or blank for CURRENT date)   (blank)
Date Format                        %s
Return Key                         now_epoch