liamloveslearning Posted May 18, 2010 Share Posted May 18, 2010 hi all, im trying to show 2 different classes based on dates, I have this function ... <?php $timeStmp=mktime($row_rsworksorders1['intraartapproval']); if($timeStmp+1209600 > time()) { ?> <tr style="background-color:black;" class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>"> <?php } else { ?> <tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>"> <?php } ?> Ive tried echoing both time() and $timeStmp only there both displaying the same, 1274157756 seconds which is from 1970. Anybody give me an idea on whats happening? Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/ Share on other sites More sharing options...
kenrbnsn Posted May 18, 2010 Share Posted May 18, 2010 What is the value of $row_rsworksorders1['intraartapproval']? Ken Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/#findComment-1060128 Share on other sites More sharing options...
liamloveslearning Posted May 18, 2010 Author Share Posted May 18, 2010 Hi Ken, It should be a date relative to a job id which I have specified in a recordset... $query_rsworksorders1 = "SELECT worksorders.intrajobno, worksorders.intratype, worksorders.intrastatus, worksorders.intracustomer, worksorders.intradescription, worksorders.intraorder, worksorders.intraartapproval, worksorders.intraestimatedinstall, worksorders.intraprio, worksorders.intrajobvalue, worksorders.intraterms, worksorders.intrajobref, worksorders.id, worksorders.intradelete FROM worksorders WHERE {$NXTFilter_rsworksorders1} AND worksorders.intradelete != 0 ORDER BY {$NXTSort_rsworksorders1}"; Ive just echo'd the variable however but its outputting nothing which is obviously the problem Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/#findComment-1060130 Share on other sites More sharing options...
liamloveslearning Posted May 18, 2010 Author Share Posted May 18, 2010 I also have to mention im using a looper, could that be a problem? Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/#findComment-1060133 Share on other sites More sharing options...
liamloveslearning Posted May 18, 2010 Author Share Posted May 18, 2010 My date in the db is stored as YYYY-MM-DD, will the mktime not work with this format? Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/#findComment-1060152 Share on other sites More sharing options...
PFMaBiSmAd Posted May 18, 2010 Share Posted May 18, 2010 Did you read the definition of mktime() in the manual? That is the only way you can effectively learn to use a function - http://us2.php.net/mktime Link to comment https://forums.phpfreaks.com/topic/202166-mktime-not-working/#findComment-1060162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.