Skip to content

Instantly share code, notes, and snippets.

View gmatta01's full-sized avatar
🏠
Working from home

G Matta gmatta01

🏠
Working from home
  • 04:46 (UTC +05:30)
View GitHub Profile
@kyleweiner
kyleweiner / PHP Set Timezone By Offset
Created January 7, 2013 06:43
PHP: A snippet for setting the default timezone using a GMT offset.
// Set the default timezone using a GMT offset
$offset = -5; // GMT offset
$is_DST = FALSE; // observing daylight savings?
$timezone_name = timezone_name_from_abbr('', $offset * 3600, $is_DST); // e.g. "America/New_York"
date_default_timezone_set($timezone_name);