-1

i have three time server,time-nw.nist.gov, time1.ucla.edu ,time.ien.it now how can i get current time for all this server in java/android?

Silvans Solanki
  • 1,267
  • 1
  • 14
  • 27
  • possible duplicate of [use of ntp service](http://stackoverflow.com/questions/7677674/use-of-ntp-service) – Snicolas Apr 06 '12 at 10:01

1 Answers1

1

Check Apache Commons Net library

https://commons.apache.org/net/

From their example:

public static final void timeTCP(String host) throws IOException
{
    TimeTCPClient client = new TimeTCPClient();
    try {
          // We want to timeout if a response takes longer than 60 seconds
          client.setDefaultTimeout(60000);
          client.connect(host);
          System.out.println(client.getDate());
    } finally {
          client.disconnect();
    }
}
jordeu
  • 6,711
  • 1
  • 19
  • 19