I have this script which converts an array of 1-24 military time to AM/PM for the user to see. I want this script not only to display the hour and am/pm, but with the users local time. Can it be done?
Here is my script I am using to display the hour:
foreach($timelist as $time):
echo "<input type='radio' name='time' value='$time' />";
//echo $time;
$hr = ($time <= 12 ? $time : ($time - 12));
$ampm = ( (($time >= 12) and ($time < 24)) ? 'PM' : 'AM' );
echo $hr." ".$ampm;
echo "<br />";
endforeach;
I want $hr to display for example 12 GMT as the current users local time. So if they were in PST it would be 5 PST instead of 12 GMT because of the users location. Don't forget about AM/PM switching depending on location.
Any help is appreciated.
Thank You.