Reputation: 10649
I'm trying to show the time 10 days from now.
$now = time();
$est = ($now - (60 * 60 * 4)); // subtract 4 hours
$later = ($est + (60*60*24*10));
$show_now = date('M m, Y h:i:s A', $est); // correct
$show_later = date('M m, Y h:i:s A', $later); // showing same as above...WHY!?
echo "now: ".$show_now."<br />later: ".$show_later;
Both echo the same time. Why?
Upvotes: 0
Views: 127
Reputation: 65264
$show_now = date('M m, Y h:i:s A', $est); // correct
$show_later = date('M m, Y h:i:s A', $later); // showing same as above...WHY!?
should be
$show_now = date('M d, Y h:i:s A', $est); // correct
$show_later = date('M d, Y h:i:s A', $later); // NOT showing same as above
else you don't show the day, resulting in identical output before the 20th of each month
Upvotes: 3