Comparing dates

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 25, 2011   (RSS)

By ikanizaj - April 22, 2011

I would like to do something like this, but I don't know syntax:

If (currentDate - createdDate < 5) {
<span>new article</span>
}

--
Igor Kani¾aj

Re: [ikanizaj] Comparing dates

By robin - April 25, 2011

Hey

To test if a date is less than 345600 seconds in the past, try something like this:
if((time() - strtotime($record['Date'])) < 345600) {
echo "less";
}
else {
echo "more";
}


Hope that helps,
Robin
Robin
Programmer
interactivetools.com