如何从Google for Android获取当前时间?

IIR*_*hII 5 api time android

是否有Google API可以从时区获取当前时间?如果有,该如何使用?我想从特定时区获取当前的在线时间,例如获取“当前时间:03/08/2015 11:27:54”之类的信息。我想从Google那里得到它,因为它充满信心。

谢谢!

IIR*_*hII 2

这足以得到我想要的:

使用 HttpGet、客户端和响应,我设法从响应日期标头中获取服务器的当前时间。我可以随时拨打此电话,并且会得到自信的答复(Google 几乎 100% 可用,我可以相信会获得正确的日期和时间)

try{
        HttpClient httpclient = new DefaultHttpClient();
        HttpResponse response = httpclient.execute(new HttpGet("https://google.com/"));
        StatusLine statusLine = response.getStatusLine();
        if(statusLine.getStatusCode() == HttpStatus.SC_OK){
            String dateStr = response.getFirstHeader("Date").getValue();
            //Here I do something with the Date String
            System.out.println(dateStr);

        } else{
            //Closes the connection.
            response.getEntity().getContent().close();
            throw new IOException(statusLine.getReasonPhrase());
        }
    }catch (ClientProtocolException e) {
        Log.d("Response", e.getMessage());
    }catch (IOException e) {
        Log.d("Response", e.getMessage());
    }
Run Code Online (Sandbox Code Playgroud)