In a PHP site, I have the current time setting:
D j M Y, G:ia
How do I change that to reflect current pacific time with the daylight saving time?
In a PHP site, I have the current time setting:
D j M Y, G:ia
How do I change that to reflect current pacific time with the daylight saving time?
You can use date_default_timezone_set
to set the timezone in which all date functions are run. PHP date functions take care of DST for you if you just want the current time.
date_default_timezone_set('America/Los_Angeles'); // or wherever you are
$time = time();
if ($time >= strtotime("Second Sunday March 0") && $time < strtotime("First Sunday November 0"))
{
echo date('m/d/y h:i a', $time);
} else {
echo date('m/d/y h:i a', $time);
}