• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Time Problem Over Network

 
Khurram Mahmood
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get the Show correct current GMT over the network in an applet as it is not predictable whether or not the client has correct date?
I am using following code I have to display time of five different countries.

private void getTime(String server)
{
try{
URL url = new URL("http://"+server);
URLConnection ucon = url.openConnection();
ucon.setDoInput(true);
ucon.connect() ;
long l = ucon.getDate();
Date d= new Date(l);
lbl.setText(d.toString());
System.out.println(d);
}catch(Exception e)
{
e.printStackTrace();
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!