Jump to content

Date difference


adzie

Recommended Posts

Hello folks,

 

 

Date difference again, I only post this as there is very little resource available on this when searching.

 

I want to perform a certain action if a date is more than 28 days or similar so.

 

$record produces the date 2009 - 07 -31.

 

Any direction appreciated.

 

If $record > 28 days {

echo "no test";

}else{

echo "test";

}

Link to comment
Share on other sites

There's always other ways to do things, but that is a very straight forward way to do it... Another option would be to explode your date to seperate the year, month and day. Then comapre the day to the current day, compare the month to the current month and year to the current year. Then work you're way through the difference in the day, if it's less than 28 see if the months are different, if they're not check if the years are different, if not then its less than 28 days.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.