How to merge date and time fields in GSheet using CF7 GSheetConnector

How to merge date and time fields in GSheet using CF7 GSheetConnector

How to merge cells like date and time in one column in Google Sheet, using CF7 GSheetConnector PRO version?

Here is the Answer for you, You can merge fields in Google Sheet using CF7 Custom Mail Tags

CF7 GSheetConnector Pro

add_filter( "gscf7_special_mail_tags", "add_custom_mail_tag", 10, 2 );

function add_custom_mail_tag( $custom_mail_tags, $form_id ) {

$custom_mail_tags[] = "_datetime";

return $custom_mail_tags;
}

add_filter( "wpcf7_special_mail_tags", function( $output, $name, $html ) {
if ( $name === "_datetime" ) {
$submission = WPCF7_Submission::get_instance();
if ( $timestamp = $submission->get_meta( 'timestamp' ) ) {
$date = date_i18n( get_option( 'date_format' ), $timestamp );
$time = date_i18n( get_option( 'time_format' ), $timestamp );
$date_time = $date . " " . $time;
return $date_time;
}
}
return $output;
}, 10, 3 );

Leave A Comment