So I’m using the PHP API to update various contact details of a certain users (including about 30 custom fields) - everything works apart from one date field which is a custom date field.
Using the example above - the FirstName updates no problem but nothing seems to happen
with the date field. I’ve also tried using dashes instead of slashes.
Below is the makeup of the field - Label, Type and DB Name
To follow up on Ming’s question, since I’ve been having this same problem, and after trying pretty much every date format, the correct format to use is Y-m-d. That’s the only one that worked for me
Here is the closing portion of this infinite stupidity.
apparently php assumes your country based on - vs /
if you use / it assumes USA
(dash) lost to auto formatting assumes not USA
str_replace the - to / and then this will work past the 12 th day of the month.
6 hours of my life gone for that. enjoy
I am using Y-m-d date format and it is working in my most of the infusionsoft accounts But its not working in one of our user’s infusionsoft account(always blank custom field’s value). I have tried all of the possible date formats but its is not working for me. Can anyone please suggest me what else should I try in this regards
With this data {“FirstName":“Arvinder”,“Email”:"arvinder.kumar@softobiz.com”,“TimeZone”:“Asia/Kolkata”,“_WebinarDate”:“20190611”,“_WebinarDateTimeCombo”:“2019-06-10 16:30:00”} I am sending (although I have changed the date format many )but it acts in a strange way somtimes it will update the webinardate field and sometimes does not ?
When I looked at REST in the past, querying the Date and Time required to be in this format “YYYY-MM-DDTHH:II:SS.000-HH:MM”. The latter “HH:MM” part was a Timezone Offset.
Eg: 2013-10-09T16:15:24.000-07:10
So maybe your could try the following PHP Date Format: “Y-m-d\TH:i:s.000”
If that fails, try: “Y-m-d\TH:i:s.000-00:00”
The reason why it maybe acting strangely is that it tries to work out if you have a valid date or not. Sometimes it will go through depending on the numbers. Either that, or there is bug in the API, or you may have a bug in your code.
@Pav Thanks for the reply I have tried both types but it is not working for me. This is the data I am sending to infusionsoft Array
(
[FirstName] => Arvinder3
[Email] => fgdfgdfg@dghfgh.mh
[TimeZone] => Asia/Kolkata
[_WebinarDate] => 2019-06-13T00:00:00.000
[_WebinarDateTimeCombo] => 2019-06-13 15:00:00
)
Issue only occurs in _WebinarDate field it is of type date. I have tried all possible date formats and datetime formats but some times it updates but in most of the cases it doesn’t update the field value.
This is the code I am using $contactId = $infusionsoftObj->contacts->addWithDupCheck($formattedData, ‘Email’);
$resinf = $infusionsoftObj->contacts->update($contactId, $formattedData);
And in $formattedData I am passing the data as shown above. Any suggestions will be appricated.
Been experimenting with this, and John’s original reply was correct.
It needs to be be in the “Ymd” format.
date('Ymd', strtotime('2024-09-22'))
If the Date was appearing Blank, then the Date was not correctly set. In Aram’s code example the date is not correct, as the year is set to “18” and not “2018”.