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 |
What is php session id?
What is difference between rest api and restful api?
Is key exist in array php?
Tell me whether it is possible to share a single instance of a memcache between multiple php projects?
Is php deprecated?
What is the function used to change the root directory in PHP?
What is the role of the .htaccess file in php?
What is the difference between apache vs niginx?
How do you add a joomla Template in admin panel of joomla? Please mention the steps
3 Answers Cognizant, T3 Softwares,
What is the purpose of destructor ?
What is difference between str_replace and substr_replace
Do you know design patterns. List few?