how can i get USA time using php...



how can i get USA time using php.....

Answer / arunkumar.s

Hello friends,
Following time zones are used EST,CST,MST,PST,AKST,HST. If
you want to get EST time then,

<?php
putenv('TZ=EST');
echo date("H:i:s :a");
?>


All other time zone's
<?php
putenv('TZ=EST');
echo date("H:i:s :a");
echo "<br/><br/>";
putenv('TZ=CST');
echo date("H:i:s :a");
echo "<br/><br/>";
putenv('TZ=MST');
echo date("H:i:s :a");
echo "<br/><br/>";
putenv('TZ=PST');
echo date("H:i:s :a");
echo "<br/><br/>";
putenv('TZ=AKST');
echo date("H:i:s :a");
echo "<br/><br/>";
putenv('TZ=HST');
echo date("H:i:s :a");
?>

Pls check and try
All the best

Is This Answer Correct ?    7 Yes 3 No

Post New Answer

More PHP Interview Questions

Can we use include ("xyz.php") two times in a php page "index.php"?

0 Answers  


What is string function sql?

0 Answers  


Explain $_FILES Superglobal Array?

0 Answers  


What is the best way to test the strpos() return value in php?

0 Answers  


Does facebook use php framework?

0 Answers  






What is the use of stripslashes in php?

0 Answers  


Write a query to find the 2nd highest salary of an employee from the employee table?

0 Answers  


What does a delimiter do in mysql?

0 Answers  


Write down the code for save an uploaded file in php.

0 Answers  


What is the difference between the include() and require() functions?

0 Answers  


What is basename php?

0 Answers  


What is preg_match?

0 Answers  


Categories