Published in: PHP
Converts current time to that of another timezone. Custom Variables: $user->personal_data['timezone'] // users' timezone
# Timezone Adjustments function timezone_get_gmz( $input ){ // return offset of unix time - offset of time // date O returns system's timezone offset: -0500.. -0800.. // therefore, hours turn from 3600 to 36 } function timezone_convert($time, $hoursOffset = -5){ // default of EST // - hoursOffset because offset for EST is 5.. but you subtract it // this will multiply GMZ time by the hours offset defined return timezone_get_gmz($time)+(3600*(-$hoursOffset)); } function timezone_makeDate ($format='',$input){ global $user; // check for input :: Default = time () // convert input to unix if not a number // get user timezone if it's set // apply timezone time to time and return in format of date $timezone = $user->personal_data['timezone']; else $timezone = 5; if ($format=='') return timezone_convert($input,$timezone); else }
You need to login to post a comment.
