On which one?
To get the time on the localhost just:
date ("l dS of F Y h:i:s A",time());
but... I repeate this port must be open (port 13). So you will have to contact this sysAdmin, or if you want to be Rude like me just do a portscan (I think if you are running Linux you can not get seen by doing a nmap -sS <hostname>). Or just telnet into port 13.
telnet <hostname> 13
There is also a regular time port of of port 37, but by telneting into that one it returns "garbage". I think its returning a raw time stamp which you have to format specially.
Ok back to the daytime (port 13 ) though. Just:
$fp = fsockopen("<hostname>",13,$err,$ermsg,40)
This will open a socket to some hostname on port 13 and will catch any error (with &err variable) and will store the error message in &ermsg. It has a 40 sec timeout.
Once you have opened it just:
if(!$fp)
echo "Error has occured " , $ermsg;
else
echo fgets($fp,300);
fclose($fp);
Hope this helps!