note 64050 added to function.date
| From: | (FlipperPA) | Date: | Thu, 06 Apr 2006 12:54:11 +0000 |
| Subject: | note 64050 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107437@lists.php.net to get a copy of this message | ||
Here's a bit of a hack that is handy to run as a cron job to keep your system clock in sync
(for *nix systems). While this is subject to change, the www.time.gov web site hasn't changed
in about a decade. Its currently set for the United States east coast time; change the URL's
"-5" to set appropriately for your time zone.
<?php
$fp=fopen("http://www.time.gov/timezone.cgi?Eastern/d/-5","r");
while(!feof($fp)) {
$data=fgets($fp,4096);
if(strstr($data,"<td align=\"center\"><font size=\"7\"
color=\"white\"><b>")) {
$data=trim(str_replace("<td align=\"center\"><font size=\"7\"
color=\"white\"><b>","",str_replace("<br>","",$data))\
);
$data=explode(":",$data);
if(strlen($data[2]==1)) $data[2]="0".$data[2];
exec("date
".date("md").$data[0].$data[1].date("y").".".($data[2]+3));
echo("date
".date("md").$data[0].$data[1].date("y").".".($data[2]+3));
die();
}
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 67.154.250.154
----
X-Spam-Status: No, hits=4.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_20_30,HTML_FONTCOLOR_UNKNOWN,HTML_MESSAGE autolearn=no
version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/note/edit/64050
Del: integrated -- http://master.php.net/note/delete/64050/integrated
Del: useless -- http://master.php.net/note/delete/64050/useless
Del: bad code -- http://master.php.net/note/delete/64050/bad+code
Del: spam -- http://master.php.net/note/delete/64050/spam
Del: non-english -- http://master.php.net/note/delete/64050/non-english
Del: in docs -- http://master.php.net/note/delete/64050/in+docs
Del: other reasons-- http://master.php.net/note/delete/64050
Reject -- http://master.php.net/note/reject/64050
Search -- http://master.php.net/manage/user-notes.php