CincoPistolero Posted November 6, 2009 Share Posted November 6, 2009 I have a page that displays current date. Cool. Problem, It appears that the server is in central europe. So here it is 3pm in California and my page thinks its tomorrow. Below is how I get the date. Is there a way to change this so it subracts like 9 hours from the current server time. createdDate= date("F j, Y"); Link to comment https://forums.phpfreaks.com/topic/180610-solved-working-with-dates/ Share on other sites More sharing options...
Cardale Posted November 6, 2009 Share Posted November 6, 2009 Good place to start. http://www.php.net/manual/en/function.date-default-timezone-set.php <?php date_default_timezone_set('America/Los_Angeles'); $script_tz = date_default_timezone_get(); if (strcmp($script_tz, ini_get('date.timezone'))){ echo 'Script timezone differs from ini-set timezone.'; } else { echo 'Script timezone and ini-set timezone match.'; } ?> Link to comment https://forums.phpfreaks.com/topic/180610-solved-working-with-dates/#findComment-952888 Share on other sites More sharing options...
CincoPistolero Posted November 6, 2009 Author Share Posted November 6, 2009 I also found this <? echo "Original Time: ". date("h:i:s")."\n"; putenv("TZ=US/Eastern"); echo "New Time: ". date("h:i:s")."\n"; ?> Here: http://www.modwest.com/help/kb5-258.html Link to comment https://forums.phpfreaks.com/topic/180610-solved-working-with-dates/#findComment-952895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.