PHP API not updating custom date field?


(Aram Tchividjian) #1

Hi all

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.

$data = array(’_NEWDateField’ => “3/18/18”,“FirstName” => “Fergz1”);
$infusionsoft->contact( ‘update’, $ifsID, $data );

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

NEW Date Field Date NEWDateField

Can anyone tell me where I’m going wrong?

Thanks in advance!


(John Borelli) #2

Try changing the date format to temporal as in 20180318


(Aram Tchividjian) #3

I updated the date value to the format you mentioned above and the field still remains blank after submission.


(John Borelli) #4

Then try a string ‘03-18-2018’. Also, your code snippet would be helpful.


(Aram Tchividjian) #5

Thanks for your reply! You were correct, I tested a few different date formats, and the correct format was ‘Y-d-m’ ‘2017-09-18’


(Ming Zhang) #6

Hi Aram,

Thank you for pointing out the solution.
I found your suggestion includes 2 options:

  • ‘Y-d-m’
  • ‘2017-09-18’, which is ‘Y-m-d’

Does both of them working for you?


(John Borelli) #7

I think it depends on TZ