gwp_date_format
The gwp_date_format Merge Tag Modifier returns a modified date time relative to the date time of a field-value with a date/time string in the desired format.
{Date Field:1:gwp_date_format modify="first day of next month" format="d-m-Y"}
| Settings | Info |
|---|---|
| modify (optional) | For available date time modifications, see https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative. |
| field_format (optional for date fields, required for other fieldtypes) | Format of the input. For an explanation of available format options, see https://www.php.net/manual/en/datetime.format.php. Regular character can be escaped using a backslash \. For example: ‘d/m/Y\ \a\t\ H:i:s’. |
| format (optional) | Format of output, default =’Y-m-d H:i:s’ |
| field_timezone (optional) | Default is WordPress timezone setting |
| timezone (optional, default is WordPress timezone setting) | For available timezones, see https://www.php.net/manual/en/timezones.php. Example: Europe/Amsterdam It is also possible to use an offset value: +0200 |
Using with Date Field
Example where field 1 is a Date Field:
{Date Field:1:gwp_date_format modify="first day of next month" format="d-m-Y"}
Using with Text Field
Example where field 2 is a Text Field:
{Text Field:2:gwp_date_format field_format="Y-m-d" field_timezone='UTC' format="d/m/Y\ \a\t\ H:i:s" timezone='Europe/Amsterdam'}
Input format of the field value
- Date field: you do not need
field_format. The modifier reads the date format set in the field (mm/dd/yyyy, dd/mm/yyyy, dd-mm-yyyy, dd.mm.yyyy, yyyy/mm/dd, yyyy-mm-dd or yyyy.mm.dd). - Other fields (Single Line Text, Hidden, and so on): set
field_formatto the format of the stored value, likeY-m-d H:i:s. Without it, the modifier returns an “unknown date field format” error. - Unix timestamp: use
field_format="U"for a timestamp in seconds since 1 January 1970 UTC. - Local timestamp: use
field_format="U_local"for a timestamp that holds the local (wall clock) time instead of UTC. The number is read as a time infield_timezone.
{Timestamp:5:gwp_date_format field_format="U_local" field_timezone="Europe/Amsterdam" format="d-m-Y H:i"}
Timezones and nested merge tags
field_timezone is the timezone of the stored value and timezone the timezone of the output. Both default to the WordPress timezone setting and accept a timezone name like Europe/Amsterdam or an offset like +0200.
modify, timezone and field_timezone support nested merge tags, so a value can come from another field:
{Date Field:1:gwp_date_format modify="+*|Days:3|* days" timezone="*|Timezone:4|*" format="d-m-Y"}
For more modify examples, see Relative Date Formats in Gravity Forms.
Try it
Since
The gwp_date_format modifier was added in 1.2.
Frequently Asked Questions
You can use the gwp_date_format modifier to output a Date field in your desired format. This is useful for showing dates in different styles — for example, 07-06-2025 or June 7, 2025.{Date Field:4:gwp_date_format format="d-m-Y"}
You can add a modify option to shift the displayed date by any relative amount — days, weeks, months, and more.{Date Field:4:gwp_date_format modify="+1 week" format="d-m-Y"}{Date Field:4:gwp_date_format modify="-2 days" format="Y/m/d"}
If you’re using a Text field to store a date (for example, 2025-06-07), you can still use gwp_date_format. You must provide the field_format so it knows how to parse your text.{Text Field:1:gwp_date_format field_format="Y-m-d" format="d/m/Y"}
You can use the timezone option to control which timezone is used when displaying the date.{Text Field:1:gwp_date_format field_format="Y-m-d" modify="+2 days" timezone="Europe/Amsterdam" format="d-m-Y H:i:s"}
field_format tells GravityWP how to read the original value (needed for Text fields).
format tells GravityWP how to display the output value.
The modify option supports natural language phrases and advanced date math — not just simple day or week offsets. You can shift a date using flexible terms like:
– +1 week, -2 days
– next monday, last friday
– first day of next month, last day of -1 month
– third wednesday of this month
You can even combine these phrases or use dynamic values with nested merge tags:{Date Field:4:gwp_date_format modify="last monday" format="d-m-Y"}{Date Field:4:gwp_date_format modify="*|Date Modifier:5|*" format="d-m-Y"}
This makes modify extremely powerful for working with deadlines, schedules, or user-defined logic