xeirus Posted July 31, 2008 Share Posted July 31, 2008 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. Link to comment https://forums.phpfreaks.com/topic/117474-compare-a-pair-of-given-dates-with-the-ones-in-mysql-database/ Share on other sites More sharing options...
unkwntech Posted July 31, 2008 Share Posted July 31, 2008 I would just store the price for each range in the database and then select the one appropriate to the current date. Link to comment https://forums.phpfreaks.com/topic/117474-compare-a-pair-of-given-dates-with-the-ones-in-mysql-database/#findComment-604288 Share on other sites More sharing options...
xeirus Posted July 31, 2008 Author Share Posted July 31, 2008 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 ... Link to comment https://forums.phpfreaks.com/topic/117474-compare-a-pair-of-given-dates-with-the-ones-in-mysql-database/#findComment-604293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.