Dmitrii Maslennikov
Dmitrii Maslennikov

Reputation: 338

How do I pass a date in the Java Date format to cURL (PHP)?

There is an Android application, it sends to the server through Parse.com one of the parameters in the format Date:

HashMap<String, Object> p = new HashMap();
p.put("created", Calendar.getInstance().getTime());
ParseCloud.callFunctionInBackground(f, p, v);

How can I pass a parameter in the same format, but only through cURL in PHP? I tried to pass a string value to the array, the server does not accept the request:

array('created'=>'Sun Nov 12 2017 02:58:09 GMT+0300')

As I understand, it is necessary to pass the parameter in the form of the Date object itself, but the question is how it will look in the raw text form?

I tried to pass the Date as an array, but this server does not want to accept either:

array('__type'=>'Date','iso'=>'2017-11-11T12:35:39.273Z')

Upvotes: 0

Views: 400

Answers (1)

montymxb
montymxb

Reputation: 86

You can pass a date to parse-server in ISO 8601 format (with millisecond precision), as mentioned in the REST docs.

{
    "__type": "Date",
    "iso": "2011-08-21T18:02:52.249Z"
}

You can see an example of how this is done in the php sdk.

Upvotes: 1

Related Questions