I have a variable say $A='2015-05-12 10:00:00'.
Now I need to compare the above variable with the current date and time and find the time difference between those two.
Requirement is to enable a div tag only when the time difference is 3 hours or less.
P.S: $A is a variable. How can I convert it into Date and time and then compare with the current date and time.?
Currently tried Code is
$TodaysDate=date('Y-m-d');
$A=$Date.' '.$StartTime;
$Todaysdate=date_create(date("Y-m-d ", strtotime($Todaysdate)));
$Final_Date=date_create(date("Y-m-d ", strtotime($A)));
$Diff_Date = date_diff($Todaysdate, $Final_Date);
$Total_Diff=$Diff_Date->format('%R%a');
Which will give Date difference.But exactly what i need is 3 Hours difference in time.Any help appreciated.