Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
Code for A date Greater Than

 

 


nmsinc
User

Oct 11, 2011, 10:36 AM

Post #1 of 3 (1959 views)
Shortcut
Code for A date Greater Than Can't Post

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?

<?php

$today = time();

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

?>

<?php if ($today) > ($startdate) ?>

<td align="center" bgcolor="#777777" width="130">

<?php else: ?>

<td align="center" bgcolor="<?php echo $bgColor ?>" width="130">

<?php endif />





Thanks

nmsinc


Jason
Staff / Moderator


Oct 11, 2011, 11:03 AM

Post #2 of 3 (1958 views)
Shortcut
Re: [nmsinc] Code for A date Greater Than [In reply to] Can't Post

Hi,

Try this:


Code
<?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 - Programmer 
interactivetools.com

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


nmsinc
User

Oct 11, 2011, 1:24 PM

Post #3 of 3 (1955 views)
Shortcut
Re: [Jason] Code for A date Greater Than [In reply to] Can't Post

Jason,

As always - your suggestion worked with perfection!

Thanks