GravityExport field: DateField

A Gravity Forms date field has an option to format the date according to your preference. Unfortunately, the export functions do not honor this setting. Therefore, this class was created to fix that issue.

Filters

gfexcel_field_date_format_{form_id}_{field_id}

This filter allows you to change the format for all fields, or one in particular. It only receives the format as an argument.

Example

/**
 * Filters the date format used during a GravityExport (GFExcel) export.
 *
 * This hook allows you to customize how dates are displayed in the exported file.
 * The format should follow PHP's date formatting syntax.
 *
 * @since 1.0.0
 *
 * @param string $format The date format string. Default may vary depending on settings.
 *
 * @return string The modified date format.
 */
add_filter(
	'gfexcel_field_date_format',
	function ( $format ) {
		// Example: date will be exported as 01/01/1970.
		return 'd/m/Y';
	}
);
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us