How to get the server date time.Android App is going access webservice.I want to know how to get the server time.Here I want to pass.Currently I did i got android time.....
// ksoap2 calling wcf
public SoapPrimitive soapPrimitiveData(String tablename) throws IOException,XmlPullParserException {
SoapPrimitive responsesData = null;
SoapObject requestData = new SoapObject(NAMESPACE, METHOD_TABLEDATA); // set
//This place I need to get server time.Here I did as normal way
Date date = new Date();
DateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
String strDate = formatter.format(date);
requestData.addProperty("strBusinessUnit", strBusinessUnit);
requestData.addProperty("strExecutive", strExecutive);
requestData.addProperty("st开发者_如何学运维rTableName", tablename);
requestData.addProperty("strDate", strDate);
requestData.addProperty("strTerritoryCode", strTerritoryCode);
SoapSerializationEnvelope envelopes = new SoapSerializationEnvelope(SoapEnvelope.VER11); // put all required data into a soap//// envelope
envelopes.dotNet = true;
envelopes.setOutputSoapObject(requestData);
AndroidHttpTransport httpTransport = new AndroidHttpTransport(APPURL);
httpTransport.debug = true;
try {
httpTransport.call(SOAP_ACTION1, envelopes);
responsesData = (SoapPrimitive) envelopes.getResponse();
} catch (SocketException ex) {
ex.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return responsesData;
}
please help me ...
Thanks in advance....
To get the server time, you should have an interface with the server where you can request the time.
For example, getTime.php
could be :
echo gmdate();
精彩评论