import java.awt.*;
import java.applet.Applet;
import java.net.*;
import java.util.Date;
import java.io.DataInputStream;

public class PageDater extends Applet
{	public void init()
	{	resize(260, 60);
		try
		{	U = this.getDocumentBase();
			UC = U.openConnection();
			mod = "Page Last Modified: " +  new Date(UC.getLastModified());

			S = new Socket(this.getCodeBase().getHost(), 13);//Port 13 is system clock.
			is = new DataInputStream(S.getInputStream());		
			curr = "Current Date in NYC: " + is.readLine();
		}catch(Exception e){}
	}
		
	public void paint( Graphics g ) 
	{	try
		{	g.drawString( mod, 20, 20 );
			g.drawString( curr, 20, 40 );
		}catch(Exception e){}
	}
	
	private URL U;
	private URLConnection UC;
	private Socket S;
	private DataInputStream is;
	private String mod;
	private String curr;
}
