Summary
The entry date merge tags can be used in notifications, confirmations, and with some add-ons to output the date and/or time the entry was created, updated, and paid. They cannot be used in field settings.
Since
Support for these merge tags was added in Gravity Forms 2.5. They were previously only available when using selected third party add-ons from certified developers.
Important
The date_created, date_updated, and payment_date are stored in the entry and database using UTC in the YYYY-MM-DD HH:MM:SS
format. The values will be formatted for output using the timezone, date, and/or time formats from the WordPress General Settings screen.
For the examples below the value stored in the entry for specified property is 2021-04-21 10:30:15
UTC, the timezone is set to Europe/London
, the date format is set to F j, Y
, and the time format is set to g:i a
.
Default Usage
Outputs the specified date.
Merge Tag | Output |
---|---|
{date_created} | April 21, 2021 |
{date_updated} | April 21, 2021 |
{payment_date} | April 21, 2021 |
Modifiers
:time
Adds at [time]
to the output.
Merge Tag | Output |
---|---|
{date_created:time} | April 21, 2021 at 11:30 am |
{date_updated:time} | April 21, 2021 at 11:30 am |
{payment_date:time} | April 21, 2021 at 11:30 am |
:format
Define a custom format for the output using the WordPress and PHP date/time formatting characters.
The format must be defined after :format
, with a colon, like this :format:m/d/Y
.
If you want to use a colon in your output, it must be escaped with a backslash, like this \:
.
Merge Tag | Output |
---|---|
{date_created:format:m/d/Y} | 04/21/2021 |
{date_created:format:Y-m-d} | 2021-04-21 |
{date_created:format:d/m/Y\ \a\t\ H\:i\:s} | 21/04/2021 at 11:30:15 |
{date_updated:format:m/d/Y} | 04/21/2021 |
{date_updated:format:Y-m-d} | 2021-04-21 |
{date_updated:format:d/m/Y\ \a\t\ H\:i\:s} | 21/04/2021 at 11:30:15 |
{payment_date:format:m/d/Y} | 04/21/2021 |
{payment_date:format:Y-m-d} | 2021-04-21 |
{payment_date:format:d/m/Y\ \a\t\ H\:i\:s} | 21/04/2021 at 11:30:15 |
:human
If the entry is less than a day old, it will output a relative value using the [time] ago
format. If you want to customize the format, use the :diff and :format modifiers instead.
Merge Tag | Output |
---|---|
{date_created:human} | 15 mins ago |
{date_updated:human} | 15 mins ago |
{payment_date:human} | 15 mins ago |
If the entry is more than a day old, it will output the date using the default date format. If the :time modifier is also used, it will output [date] at [time]
using the default date and time formats.
Merge Tag | Output |
---|---|
{date_created:human} | April 21, 2021 |
{date_created:human:time} | April 21, 2021 at 11:30 am |
{date_updated:human} | April 21, 2021 |
{date_updated:human:time} | April 21, 2021 at 11:30 am |
{payment_date:human} | April 21, 2021 |
{payment_date:human:time} | April 21, 2021 at 11:30 am |
:diff
Outputs how long ago the entry was created, updated, or paid.
The default format is %s ago
, where %s
is replaced by the time difference in seconds, minutes, hours, days, weeks, months, or years.
Merge Tag | Output |
---|---|
{date_created:diff} | 1 second ago |
{date_created:diff:format:%s has passed since the form was submitted} | 5 hours has passed since the form was submitted |
{date_updated:diff} | 1 day ago |
{date_updated:diff:format:%s has passed since the entry was updated} | 3 days has passed since the entry was updated |
{payment_date:diff} | 1 week ago |
{payment_date:diff:format:payment was completed %s ago} | payment was completed 1 month ago |
Using the :time and :human modifiers with this modifier is not supported.
:raw
Outputs the value as it is stored in the entry and database. This value is also available using the Entry Merge Tag.
Merge Tag | Output |
---|---|
{date_created:raw} | 2021-04-21 10:30:15 |
{date_updated:raw} | 2021-04-21 10:30:15 |
{payment_date:raw} | 2021-04-21 10:30:15 |
This modifier cannot be used with other modifiers.
:timestamp
Outputs the value as a Unix timestamp; the number of seconds since the Unix epoch on January 1st, 1970 at UTC.
Merge Tag | Output |
---|---|
{date_created:timestamp} | 1619001015 |
{date_updated:timestamp} | 1619001015 |
{payment_date:timestamp} | 1619001015 |
This modifier cannot be used with other modifiers.