Wrong date and time format are sent to google sheet
-
Hi,
Thank you for your awesome plugin.
I have some difficulties with the update. I’ve added a custom tag by following code: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 );
It was working great. However, I have no idea why since March 28, 2020, I get all fields specially date time tags as text not in date format. Please look at provided link, there is a place to add name and the other one is number. However, Google Connector sends all date including datetime in text format. I looked at my google sheet and I found that the date has an extra ‘ added to the first of date and it’s only visible if I try to edit the date. When I edit it, and delete that single quotations sign, it will converted to datetimae again.: ‘April 12, 2020 1:11 pm to April 12, 2020 1:11 pm
I also have no idea why numbers are in text format rather than being number in my google sheet !
I look forward to hearing from you.
I’m very grateful in advance.The page I need help with: [log in to see the link]
- The topic ‘Wrong date and time format are sent to google sheet’ is closed to new replies.