I am doing the following in my php script and I am not seeing the results I though I would:
$current_date_num = strtotime("now");
echo $current_date_num ." BEFORE DATE HOUR<br/>";
$new_current = date('Y-m-d h:i:s', strtotime($current_date_num));
echo $new_current . " AFTER DATE<br/>";
$current_date_num = date('Y-m-d h:i:s', strtotime($current_date_num) - 60 * 60 * 6);
echo $current_date_num ." CURRENT<br/>";
$end_date = strtotime("+1 day");
$end_date = date("Y-m-d h:i:s",$end_date);
echo $end_date ." END DATE";
This is my output and Only the END DATE is showing what I would expect.
1322673564 BEFORE DATE HOUR
1969-12-31 07:00:00 AFTER DATE
1969-12-31 01:00:00 CURRENT
2011-12-01 12:19:24 END DATE
What I thought would happen is I get the Unix timestamp and then use strtotime and get the current time and then the current time minus 6 hours and finally the time 24 hours from now. Not sure how I am messing this up so bad?
You are applying
strtotime()two times too many. One time in line 4:remove that, and the
strtotime()call in line 7.