Showing the Local Time in Other Time Zones Sometimes, you want
to show a formatted time in the current time zone and in
other time zones as well. The following script shows a full textual
date representation for the U.S., Norway, the Netherlands, and Israel:
<?php
echo strftime("%c\n");
echo "\nEST in en_US:\n";
setlocale(LC_ALL, "en_US");
putenv("TZ=EST");
echo strftime("%c\n");
echo "\nMET in nl_NL:\n";
setlocale(LC_ALL, "nl_NL");
putenv("TZ=MET");
echo strftime("%c\n");
echo "\nMET in no_NO:\n";
setlocale(LC_ALL, "no_NO");
putenv("TZ=MET");
echo strftime("%c\n");
echo "\nIST in iw_IL:\n";
setlocale(LC_ALL, "iw_IL");
putenv("TZ=IST");
echo strftime("%c\n");
?>
to show a formatted time in the current time zone and in
other time zones as well. The following script shows a full textual
date representation for the U.S., Norway, the Netherlands, and Israel:
<?php
echo strftime("%c\n");
echo "\nEST in en_US:\n";
setlocale(LC_ALL, "en_US");
putenv("TZ=EST");
echo strftime("%c\n");
echo "\nMET in nl_NL:\n";
setlocale(LC_ALL, "nl_NL");
putenv("TZ=MET");
echo strftime("%c\n");
echo "\nMET in no_NO:\n";
setlocale(LC_ALL, "no_NO");
putenv("TZ=MET");
echo strftime("%c\n");
echo "\nIST in iw_IL:\n";
setlocale(LC_ALL, "iw_IL");
putenv("TZ=IST");
echo strftime("%c\n");
?>