Code for A date Greater Than

By nmsinc - October 11, 2011

I need to code a section for background color based on if the $updateDate is greater than 24 hours older than the current date. I'm trying the code below with no success - any ideas?[/#000000]

<?php[/#000000]

$today = time();[/#000000]

$startdate = strtotime($claims_submissionRecord['updatedDate']) + mktime(0,0,0,date("m"),date("d")+1,date("Y"));[/#000000]

?> [/#000000] [/#000000]

<?php if ($today) > ($startdate) ?>[/#000000]

<td align="center" bgcolor="#777777" width="130">[/#000000] [/#000000]

<?php else: ?>[/#000000]

[/#000000]<td align="center" bgcolor="<?php echo $bgColor ?>" width="130">[/#000000]

<?php endif />[/#000000]

[/#000000]



Thanks[/#000000]

nmsinc[/#000000]
nmsinc

Re: [nmsinc] Code for A date Greater Than

By Jason - October 11, 2011

Hi,

Try this:

<?php

$currentDateTime = strtotime(date("Y-m-d h:i:s"));
$minus24Hours = strtotime("-1 day", $currentDateTime);
$updatedDateTime = strtotime($claims_submissionRecord['updatedDate']);

?>

<?php if ($updatedDateTime < $minus24Hours): ?>
// record was last updated more than 24 hours ago


<?php else: ?>
// record has been update within the last 24 hours


<?php endif />


Hope this helps get you started
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/