Monday, 12 November 2012

PHP set(display) local time and locale

<?php
//set timezone
$timezone_offset = +8;
$current_time = gmdate('H:i:s', time()+$timezone_offset*60*60);

echo "Current time is $current_time. "

$loc_uk = setlocale(LC_ALL, 'eng');
echo "Preferred locale on this system is $loc_uk";

?>

For supported locale for windows, see here.

No comments:

Post a Comment