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

What is csrf mvc?

0 Answers  


How to connect to mysql from a php script?

0 Answers  


Does php have block scope?

0 Answers  


Does not want to see PHPSESSID in the url. How can be done this ?

3 Answers  


What are the ways to define a constant in php?

0 Answers  


•How to access crystal reports through PHP code?

1 Answers   Satyam,


Explain the difference between mysql_connect and mysql_pconnect?

0 Answers  


Xplain is it possible to use com component in php?

0 Answers  


Why do we use polymorphism in php?

0 Answers  


What is the use of mysql_real_escape_string() function?

0 Answers  


Explain me what is the meaning of a persistent cookie?

0 Answers  


!== represents what?

2 Answers  


Categories