T0X!C-uk
25-06-2005, 06:16 PM
Ok over the next week or so i will be adding some php tutorials as i have been asked a few times to help people learn.
As i dont have the time i cannot go around teaching people individually it wouldnt be possible. So i have a wrote a few tutorials that you can all use. If you read though them properly it will give you the basic idea of how php works and hopefully you will be able to learn bigger things in the future.
Hopefully all these will get moved and stickied into the websites tutorials thread :8
Tutorial 1: Grab Local Date And Time.
OK, just run this as filename.php?timezone_local=8 to get the local time
this could be handy if your host changes their local time on the server then you wont have any problems when they do.
If you are going to use this in a cms you will need to set $timezone_local to your timezone instead of the $_GET[] variable.
If your timezone is something like +9:30 you will need to set $timezone_local to 9.5
<?
$timezone_local = $_GET['timezone_local'];
$time = time();
$timezone_offset = date("Z");
$timezone_add = round($timezone_local*60*60);
$time = round($time-$timezone_offset+$timezone_add);
$date = date("l dS of F Y h:i:s A", $time);
echo $date;
?>
As i dont have the time i cannot go around teaching people individually it wouldnt be possible. So i have a wrote a few tutorials that you can all use. If you read though them properly it will give you the basic idea of how php works and hopefully you will be able to learn bigger things in the future.
Hopefully all these will get moved and stickied into the websites tutorials thread :8
Tutorial 1: Grab Local Date And Time.
OK, just run this as filename.php?timezone_local=8 to get the local time
this could be handy if your host changes their local time on the server then you wont have any problems when they do.
If you are going to use this in a cms you will need to set $timezone_local to your timezone instead of the $_GET[] variable.
If your timezone is something like +9:30 you will need to set $timezone_local to 9.5
<?
$timezone_local = $_GET['timezone_local'];
$time = time();
$timezone_offset = date("Z");
$timezone_add = round($timezone_local*60*60);
$time = round($time-$timezone_offset+$timezone_add);
$date = date("l dS of F Y h:i:s A", $time);
echo $date;
?>