You can’t modify date_created on Export
Gravity Forms date_created
field isn’t actually a field that’s affected by that hook. If you look in /exports.php
you’ll find in start_export()
that they bypass the filter for ID’s date_created
and payment_date
and hard-code force the use of Y-m-d H:i:s
foreach ( $leads as $lead ) {
GFCommon::log_debug( __METHOD__ . '(): Processing entry #' . $lead['id'] );
foreach ( $fields as $field_id ) {
switch ( $field_id ) {
case 'date_created' :
case 'payment_date' :
$value = $lead[ $field_id ];
if ( $value ) {
$lead_gmt_time = mysql2date( 'G', $value );
$lead_local_time = GFCommon::get_local_timestamp( $lead_gmt_time );
$value = date_i18n( 'Y-m-d H:i:s', $lead_local_time, true );
}
break;
default :
$field = RGFormsModel::get_field( $form, $field_id );
$value = is_object( $field ) ? $field->get_value_export( $lead, $field_id, false, true ) : rgar( $lead, $field_id );
$value = apply_filters( 'gform_export_field_value', $value, $form_id, $field_id, $lead );
...
Instead
You can create a custom field in your form, make it a hidden field,
then use another gform_pre_submission
hook to fill it with your server time on submission.
Being a GravityForms customer, their support is superior, maybe they’ve got better tricks up their sleeves. They’re also pretty open to suggestions – opening a ticket as a suggestion to add a hook for that date format there might be worth a try.