Comparing dates

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

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

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