If timezone is not set in php.ini then the default time zone will be taken as UTC format.

I figured it out and here's what you do (ASSUMING THE SERVER IS ON GMT, If not, just echo a generic gmdate() without timezone setting and calculate the number of hours ahead or behind you are of that time, convert it to seconds and add [for ahead] or subtract [for behind] that value to time())

Example:

REMEMBER - THE VALUES ABOVE ASSUME THE SERVER IS ON GMT

$date_of_completion = "03-Oct-2014 00:00:00";
$certdate = strtotime($date_of_completion);

if(date_default_timezone_get() == 'UTC') {
 $certdate +=(10*60*60);
}

echo "<br>Correct date is: ".$certdate;


NOTE: these are US times [setlocale(LC_TIME, 'en_US')]

for Central Time (7 hours behind GMT):
gmdate("format", time()-(25200));

For Pacific Time (9 hours behind GMT):
gmdate("format", time()-(32400));


0 comments:

Blog Archive

Total Pageviews

Popular Posts