I am trying to post a Date object Date date = new Date()
to a remote PHP script using HTTPClient but it seems like NameValuePair
does not accept any other Java objects other than a String
? Would appreciate if you can guide me how to post a Date
object using HTTPClient
Here's my code
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
Date date = new Date();
postParameters.add(new BasicNameValuePair("stringObj", "Test")); //No error
postParameters.add(new BasicNameValuePair("dateTime", date)); //Error here
try{
String response = CustomHttpClient.executeHttpPost("http://remotewebsite/test.php", postParameters);
catch{
// ...
}