function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EvanAlterEvanAlter 

What is the valid DateTime format for PHP?

I have been trying to create an Event with PHP for a week now and I keep running into dead ends. Now that I think I finally got it working with the SalesforceClient.php I am getting back and invalid dateTime type. However I used the same format that salesforce returned the dateTime to me in.

Here is the error.

stdClass Object ( [errors] => stdClass Object ( [fields] => [message] => ActivityDateTime: value not of required type: 2005-01-02T21:12:00Z [statusCode] => INVALID_TYPE_ON_FIELD_IN_RECORD ) [id] => [success] => false )

best I can tell 2005-01-02T21:12:00Z is the right format
SynchroSynchro
I asked something similar here: http://forums.sforce.com/sforce/board/message?board.id=PerlDevelopment&message.id=647

I've not had a direct answer to that, but I've found that gmdate(DATE_ISO8601) works (I'm using PHP 5.1): http://www.php.net/manual/en/ref.datetime.php
SuperfellSuperfell
The format looks correct, but that error normaly occurs because the request indicates that its a different type to the expected one, e.g. if you send
<activityDateTime xsi:type="xsd:string">2005-05-05T12:22:00Z<activityDateTime>

you'll get the above error, because the xsi:type attribute says the value is a string when it should be a dateTime.
EvanAlterEvanAlter
So in PHP how do I set the type since PHP doesn't really have types.