<?php
$currentDate = date("Y-m-d");
$currentTime = date("H:i:s");
$currentDateHour = date("H", strtotime($currentDate . " " . $currentTime));
// This is the date I'm pulling from the database, it only displays
// when in strtotime for some reason. It displays accurately to what is in the mySQL DB
$upDate = date("Y-m-d H", strtotime($row2['post_date']));
// Some variables to make life easier for later if statements if I ever get that far. Displays accurately.
$upDatehour = date("H", strtotime($row2['post_date']));
// trying simple subtraction
$hour = $currentDateHour - $upDatehour;
// this is where the result is incorrect, what is wrong here? Any method I've tried gives me the same result, with or without strotime.. it's gotta be something simple, always is!
print $hour;
Warning: Undefined variable $row2 in /in/eUcvK on line 9
Warning: Trying to access array offset on null in /in/eUcvK on line 9
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 9
Warning: Undefined variable $row2 in /in/eUcvK on line 13
Warning: Trying to access array offset on null in /in/eUcvK on line 13
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 13
20
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined variable $row2 in /in/eUcvK on line 9
Warning: Trying to access array offset on value of type null in /in/eUcvK on line 9
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 9
Warning: Undefined variable $row2 in /in/eUcvK on line 13
Warning: Trying to access array offset on value of type null in /in/eUcvK on line 13
Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 13
20
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $row2 in /in/eUcvK on line 9
Warning: Trying to access array offset on value of type null in /in/eUcvK on line 9
Warning: Undefined variable $row2 in /in/eUcvK on line 13
Warning: Trying to access array offset on value of type null in /in/eUcvK on line 13
20
Output for 7.4.0 - 7.4.33
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Notice: Trying to access array offset on value of type null in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
Notice: Trying to access array offset on value of type null in /in/eUcvK on line 13
20
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
20
Output for 5.1.0 - 5.1.1
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
0
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 13
21
Output for 5.0.1 - 5.0.3
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 13
21
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Notice: strtotime(): Called with empty time parameter in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
Notice: strtotime(): Called with empty time parameter in /in/eUcvK on line 13
21
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: row2 in /in/eUcvK on line 9
Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/eUcvK on line 9
Notice: Undefined variable: row2 in /in/eUcvK on line 13
Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/eUcvK on line 13
21