Click to See Complete Forum and Search --> : is date between dates? -- Please help


kenny_inuk
08-02-2004, 07:59 AM
hi,
i am trying to create a function that will return true if a date is between two set dates and a false if it is not.
for example: (dd/mm/yyyy)
date 1: 02/03/2004
date 2: 05/06/2004

date we want to check: 01/04/2004

function: returns true

unfortuatly i have had a mantal block on how to create one for a couple of days now and could not find any example on the web.

please could any one help
:confused:

Thanks
kenny

Shrike
08-02-2004, 09:39 AM
This isn't really a PHP5 question, but anyway, here's an example

function isDateBetween($dt_start, $dt_check, $dt_end){
if(strtotime($dt_check) > strtotime($dt_start) && strtotime($dt_check) < strtotime($dt_end)) {
return true;
}
return false;
}
isDateBetween("2004-01-01", "2004-01-02", "2004-01-03")
and doStuffHooray();

kenny_inuk
08-02-2004, 09:46 AM
Top notch!

Thank you VERY much!


This isn't really a PHP5 question


Sorry! i must be more observant in the future !