Function : Converts GMT time to a localized value
Converts GMT time to a localized value
This function takes a Unix timestamp (in GMT) as input, and returns the local value based on the timezone and DST setting submitted.
/**
* Converts GMT time to a localized value
*
* Takes a Unix timestamp (in GMT) as input, and returns
* at the local value based on the timezone and DST setting
* submitted
*
* @param integer Unix timestamp = $time
* @param string timezone = $timezone
* @param bool whether DST is active = $dst
* @return integer
*/
if ( ! function_exists('gmt_to_local'))
{
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
{
if ($time == '')
{
return now();
}
$time += timezones($timezone) * 3600;
if ($dst == TRUE)
{
$time += 3600;
}
return $time;
}
}












[...] This post was mentioned on Twitter by Abhishek Sanghvi. Abhishek Sanghvi said: Function : Converts GMT time to a localized value: Converts GMT time to a localized value This function takes a… http://bit.ly/hRA6Mr [...]
[...] Link: Function : Converts GMT time to a localized value | My PHP Scripts … [...]
[...] posted here: Function : Converts GMT time to a localized value | My PHP Scripts … Related Posts:Convert Local UNIX Timestamp to GMT | My PHP Scripts | A Hub for …Function : [...]
[...] the original here: Function : Converts GMT time to a localized value | My PHP Scripts … Share and [...]