gwp_date_field
From v1.2 this the gwp_date_field merge tag is deprecated. We strongly recommend to use the gwp_date_format merge tag modifier to modify and format Date Fields and Text Fields with dates.
The gwp_date_field Merge Tag returns a modified date time relative to the date time of a field-value with a date/time string in the desired format.
{gwp_date_field id=5 modify="first day of next month" format="d-m-Y"}
| Settings |
|---|
| id (required) |
| modify (optional) |
| field_format (optional for date fields, required for other fieldtypes) |
| format (optional) |
| field_timezone (optional) |
| timezone (optional, default is WordPress timezone setting) |
Using with Date Field
Example where field 1 is a Date Field:
{gwp_date_field id=1 modify="first day of next month" format="d-m-Y"}
Using with Text Field
Example where field 1 is a Text Field:
{gwp_date_field id=1 field_format="Y-m-d \a\t\ H:i:s" field_timezone='UTC' format="d/m/Y\ \a\t\ H:i:s" timezone='Europe/Amsterdam'}
Notes
- id is the field ID (or input ID) in the current entry. The merge tag needs an entry, so it works in notifications, confirmations and other places after submission.
- For a Date field the stored format
Y-m-dis used; for other fields set field_format. Usefield_format="U"for a Unix timestamp orfield_format="U_local"for a timestamp that holds the local time in field_timezone. - field_timezone and timezone default to the WordPress timezone setting.
- modify supports nested merge tags, like
modify="+*|Days:3|* days". - An empty field returns nothing.