bezierstek
Programmer
Hi,
I have a table that holds dates in it for an availability calendar script. At the moment I hold the season dates in a date field and colour code the calendar to show the rental season. this is fine for the current year but if I want to display the next year (which has exactly the same rental seasons), I don't get anything coloured because the script is comparing the years along with the rest of teh date.
What I want to be able to do is for example if a rental period is from the 1st of July to the 31st of August to be able to pull out the dates from the database where just those months are included. I store both a start date and an endate for each season in the same record.
I suppose what I am really after is a way to structure a select statement something like this.
if that makes any sense. I know the statement above is not anywhere like a correct select statement but it just seems the easiest way to describe it.
Can anyone help?
Thanks,
I have a table that holds dates in it for an availability calendar script. At the moment I hold the season dates in a date field and colour code the calendar to show the rental season. this is fine for the current year but if I want to display the next year (which has exactly the same rental seasons), I don't get anything coloured because the script is comparing the years along with the rest of teh date.
What I want to be able to do is for example if a rental period is from the 1st of July to the 31st of August to be able to pull out the dates from the database where just those months are included. I store both a start date and an endate for each season in the same record.
I suppose what I am really after is a way to structure a select statement something like this.
Code:
select * from pricing where day and month of startdate <= day and month of currentdate and day and month of day and month of endate >= currentdate
Can anyone help?
Thanks,