Moron Posted August 11, 2006 Share Posted August 11, 2006 I'm working on an employee leave system. My script is pulling [b]all[/b] leave incidents, but I only want it to pull the last six months.Here's the code where it plugs the leave items:echo $RESULT['Lmo']; echo "/";echo $RESULT['Lda'];echo "/";echo $RESULT['LYR'];(Leave month, Leave day, Leave year).I also set a variable called....$combineddate="$RESULT[Lmo]$RESULT[Lda]$RESULT[LYR]";..which combines the above three into "08112006" format....and another one called $pastdate which pulls the date on today's date six months ago.If I use...WHERE ('$currentdate' >= '$pastdate') or IFor WHILEor anything else I've tried, it either bombs or returns nothing.I want to show records from six months ago through the present.Anybody? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 11, 2006 Share Posted August 11, 2006 To compare dates you need the date elements in Y M D sequence. MySQL and other DBMS have things called DATE fields. If you use these you have dozens of date functions at your disposal. IF you invent other ways to store dates then you have to invent ways to do the calculations them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.