php - Adding 2 hours to post time -
how add together 2 hours post time?
$config['post_date'] = '%d/%m/%y (%a) %h:%m:%s'; i've tried switching timezones doesn't alter i'm going add together 2 hours manually.
you cant add together 2 hours using strftime format directly. convert timestamp first, add together hours, feed format , timestamp. consider example:
$date = strtotime('+2 hours', time()); $config['post_date'] = '%d/%m/%y (%a) %h:%m:%s'; // strftime format $config['post_date'] = strftime($config['post_date'], $date); echo strftime('%d/%m/%y (%a) %h:%m:%s') . '<br/>'; echo $config['post_date']; output:
21/06/14 (sat) 19:59:59 21/06/14 (sat) 21:59:59 php time
No comments:
Post a Comment