Im trying to just have a simple script that will tell the current time in my time zone......anyone help?
I found this script that works however I just cant get it to echo anything.....
<?
function format_date($date)
{
$year = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day = substr($date, 6, 2);
$hour = substr($date, 8, 2);
if ($hour >= 12)
{
$daytime = 'PM';
}
else
{
$daytime = 'AM';
}
$minute = substr($date, 10, 2);
$second = substr($date, 12, 2);
if ($hour == '12')
{ $hour = '12'; }
elseif ($hour == '13')
{ $hour = '1';}
elseif ($hour == '14')
{ $hour = '2'; }
elseif ($hour == '15')
{ $hour = '3'; }
elseif ($hour == '16')
{ $hour = '4'; }
elseif ($hour == '17')
{ $hour = '5'; }
elseif ($hour == '18')
{ $hour = '6'; }
elseif ($hour == '19')
{ $hour = '7'; }
elseif ($hour == '20')
{ $hour = '8'; }
elseif ($hour == '21')
{ $hour = '9'; }
elseif ($hour == '22')
{ $hour = '10'; }
elseif ($hour == '23')
{ $hour = '11'; }
$date = $month . '/' . $day . '/' . $year . " $hour:$minute:$second $daytime";
return $date;
}
echo format_date('20031021025523');
?>
See it echos the data in that last line there but i cant get it to pull up the current date and time...some one help meeee