C# DateTime type over web service with PHP & SOAP

前端 未结 3 1934
花落未央
花落未央 2021-01-27 07:33

I work with web services written in C#, with PHP on my (client) side.

SOAP __getTypes returns that one of the expected parameter to be

3条回答
  •  星月不相逢
    2021-01-27 07:49

    For one web service we use, the service allows for filtering entries by createdAt timestamps with a DateTime object. What I've found to work with this might be a little kludgy but:

    $date = new stdClass();
    $date->DateTime = '2012-01-01T00:00:00Z';
    $date->OffsetMinutes = -480; // Los Angeles offset also can just be set to NULL
    

    Then the params could be:

    $params = array(
     'birthDate' => $date
    );
    

    I've looked for ways to use PHP's native DateTime objects but could find any easier way to go.

    Hope this helps.

提交回复
热议问题