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
Igor Kani¾aj
Re: [ikanizaj] Comparing dates
By ikanizaj - April 22, 2011
basicly, if I use this:
<?php echo date("U", strtotime($record['Date'])) ?>
<?php echo date("U") ?>
the difference should be less then 345600, but I need a little help with php programming...
--
Igor Kani¾aj
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:
Hope that helps,
Robin
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
Programmer
interactivetools.com