Time zone issue with date-type merge fields

439 views
Skip to first unread message

Mark Eirich

unread,
May 4, 2011, 3:06:38 PM5/4/11
to MailChimp API Discuss
According to this page: http://apidocs.mailchimp.com/1.3/listsubscribe.func.php,
MailChimp uses PHP's strtotime() function to parse dates.

My client is in US Pacific Time, and their MailChimp account is set to
Pacific, as far as I know.

When I put the time "2011-04-30 01:15:56 UTC" into a date format merge
field, I would expect it to be displayed in MailChimp's UI in Pacific
time. That is, it should show "04/29/2011". Instead, it shows
"04/30/2011".

This seems to mean that MailChimp isn't really using strtotime(), or
that the "UTC" part of my timestamp is being truncated.

Here is some PHP code that demonstrates how strtotime() should work:

$time = strtotime('2011-04-30 01:15:56 UTC');
date_default_timezone_set('America/Los_Angeles');
echo date('m/d/Y', $time);

The above code outputs "04/29/2011", as one would expect.

Is my only option to pre-convert timestamps to Pacific? The only
problem with that is that if the management of the list changes to our
East Coast team, some dates will be wrong again, and setting
MailChimp's time zone will not help.

jesse

unread,
May 4, 2011, 3:41:41 PM5/4/11
to MailChimp API Discuss
Passing "UTC" is causing the problem - don't do that. It's also
completely unnecessary since we already expect you to send GMT times.
Or, back up in the sentence you are quoting and "Use YYYY-MM-DD
HH:ii:ss to be safe".


jesse

Mark Eirich

unread,
May 4, 2011, 4:24:12 PM5/4/11
to MailChimp API Discuss
Jesse,

I appreciate your eagerness to help me. Please take a little more time
to research the issue.

The result is the same regardless of whether I append "UTC" to the
timestamp. I was originally sending the dates without it, but then I
appended it, hoping that would make MailChimp behave correctly.

I just now re-tested this by sending "2011-05-04 01:00:00", and
MailChimp displayed "05/04/2011". I am expecting MailChimp to display
the date after converting the timestamp to Pacific time -
"05/03/2011".

Please note that MailChimp correctly displays the "last changed" and
"date added" timestamps in Pacific time.

-Mark
> > MailChimp's time zone will not help.- Hide quoted text -
>
> - Show quoted text -

jesse

unread,
May 4, 2011, 4:39:32 PM5/4/11
to MailChimp API Discuss
I see - I thought you were talking about a field like OPTIN_TIME that
is a datetime field.

"date" type merge fields are exactly that - dates. The docs for those
say "use YYYY-MM-DD to be safe".


jesse
Reply all
Reply to author
Forward
0 new messages