+ Start a Discussion
MiguelGuerreiroMiguelGuerreiro 

PHP date field

hello,

 

I have a web page written in PHP with several fields so that my customers can created cases. One of the fields should be a data type but we're getting error messages so we switched to string. How does one define a data type field so that the case is correctly created in salesforce?

 

thank you

Park Walker (TAGL)Park Walker (TAGL)

This function will convert the input date from your form to a datetime value acceptible to the API, assuming that the input date is valid:

 

public function getGMDate($dt) {

$s2 = strtotime($dt);

$s3 = gmdate("Y-m-d\TH:i:s.000\Z", $s2);

return $s3;

}

 

Note that you should have the correct timezone set in your PHP.ini. 

MiguelGuerreiroMiguelGuerreiro
thank you. I will see if this does the job!