how can i get USA time using php...

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is rtrim php?

539


How to reset/destroy a cookie in php?

520


Explain php split() function.

533


Tell me what types of loops exist in php?

565


What is difference between strstr() and stristr()?

520






What is the Default syntax used in PHP?

589


Do you know is it possible to extend the execution time of a php script?

568


Why do we use php?

530


Explain about switch statement in PHP?

580


How can we display information of a variable and readable by a human with php?

527


What is $_ post in php?

630


What is the use of get and post method in php?

533


Explain the difference between unlink() and unset()?

524


What is the use of final class in php?

504


What is global array in php?

557