Documentation

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"}
SettingsInfo
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'}

Try it

Since

The gwp_date_format modifier was added in 1.2.

Last updated: 30-08-2023

Advanced Merge Tagsv1.6.1

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more