Jump to content

Compare a pair of given dates with the ones in MySQL database.


xeirus

Recommended Posts

Hi,

I want to have prices of products based on the period of the year.

Thus, a set of prices for all the products valid from;

a) 1/March/2008 till 31/October/2008,

b) 1/November/2008 till 30/November/2008,

c) 1/December/2008 till 31/January/2009, and

d) 31/January/2009 till 28/February/2009

 

These prices I want to store in the database, and then a user provides for example, 20/November/2008 till 10/December/2008 and the PHP/MySQL code should find out how many days of this period are in which of the period (a, b, c, or d)

 

I can find many date comparisons through Google but nothing of this type.

Can someone please help?

 

Thank you!

 

- Xeirus.

 

unkwntech,

thank you for your reply.

 

Yes but the question is, what would be the code.

Also, its not the current date. As I mentioned in my initial post that, if the user provides the dates from 20/November/2008 till 10/December/2008 then the PHP/MySQL should return saying that 10 Days would be the price of Period 'B' and 10 days would be the price of period 'C'

 

How can I possible do this? And what would be the code?

 

Please help ...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.