Support

Home Forums Event Espresso Premium Date issue with Mailchimp integration

Date issue with Mailchimp integration

Posted: September 19, 2016 at 12:49 pm

Viewing 3 reply threads


Railpromo

September 19, 2016 at 12:49 pm

Hi folks,

I followed this directions https://eventespresso.com/topic/mailchimp-automation/ to get EVENTDATE passed to Mailchimp. It works out well but for one issue.
The EVENTDATE field is set up as d/m/Y in Mailchimp. When a date is passed, however it is in the format mm/dd/yyyy, e.g. when the event date is 08-10-2016 (dd-mm-yyyy) it will turn out as 10-08-2016 in Mailchimp. Next, when I change the Mailchimp record, it actually shows the date as 10th of August instead of as 8th of October.
Over here, dd-mm-yyyy is the regular notation. Would you be able to help me to pass the event date in the correct format to Mailchimp?

Many thanks in advance.

Best regards,
Luc


Tony

  • Support Staff

September 20, 2016 at 4:27 am

The problem is actually with using / within the date format.

That date values are passed over to mailchimp which runs them through strtotime()

The problem with that is if / are used as separators then the American format is used (mm/dd/yyyy)

Then if you use – as the separator European dd-mm-yyyy is assumed.

See note 4 here: http://php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-notes

So to fix this the format passed over to MailChimp needs to be changed, the best format to use is YYYY-MM-DD as is is universal and then MailChimp will use the setting you have for dates within your general settings (or the specific date filed)

So change this line:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-mailchimp/tw_eea_mailchimp_start_date.php#L24

To be:

$merge_vars['EVENTDATE'] = $datetime->start_date( 'Y-m-d' );

Then retest another registration, does it work as expected with the merge vars then?


Railpromo

September 20, 2016 at 12:29 pm

Solved! Thanks!


Tony

  • Support Staff

September 21, 2016 at 4:46 am

You’re most welcome, thank you for letting me know.

I’ve also updated my gist with the above change for any future readers.

Viewing 3 reply threads

The support post ‘Date issue with Mailchimp integration’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso