Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can we convert the time zones using PHP?



How can we convert the time zones using PHP?..

Answer / vijaya

By using date_default_timezone_get and
date_default_timezone_set function on PHP 5.1.0
// Discover what 8am in Tokyo relates to on the East Coast
of the US

// Set the default timezone to Tokyo time:
date_default_timezone_set('Asia/Tokyo');

// Now generate the timestamp for that particular timezone,
on Jan 1st, 2000
$stamp = mktime(8, 0, 0, 1, 1, 2000);

// Now set the timezone back to US/Eastern
date_default_timezone_set('US/Eastern');

// Output the date in a standard format (RFC1123), this will
print:
// Fri, 31 Dec 1999 18:00:00 EST
echo '

', date(DATE_RFC1123, $stamp) ,'
';?>

Is This Answer Correct ?    13 Yes 6 No

Post New Answer

More PHP Interview Questions

Is facebook still written in php?

0 Answers  


What is form action php?

0 Answers  


How to set cookies in PHP?

0 Answers  


Can php run without server?

0 Answers  


How do you measure variables?

0 Answers  


Give small demo of writting OOP in PHP-mysql.

1 Answers   TCS,


Can you use both this () and super () in a constructor?

0 Answers  


How to assigning a new character in a string using php?

0 Answers  


Tell me is it possible to submit a form with a dedicated button?

0 Answers  


How to do single and multi line comment in php?

0 Answers  


1.Where are the cookies storing ? 2.What is the drawback of using cookies ? 3. If two site is having same cookie name and different values what will be the output if we echo the cookie name from those sites ? How can we solve this issue (How can we specify the domain name)?

8 Answers   TCS,


How can a cross-site scripting attack be prevented by php?

0 Answers  


Categories