I wouldn't really be the perfect person to answer this question, but does sound about right to me...:) Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: Vinay Kannan To: Toby Hart Dyke ; jacob@xxxxxxxxxxxxx Cc: php-windows@xxxxxxxxxxxxx ; phpexperts@xxxxxxxxxxxxxxx ; php mysql Sent: Thursday, June 21, 2012 1:46 PM Subject: Re: Date Problem Hi Toby, Jacob Thank You Toby and Jacob for your help! I figured my way out and was able to fix the issue, what i did was, i built another table called servicesdue and updated the columns service1,service2,service3, used DATE_ADD to populate these 3 date fields. I figured the best way to go forward to have the new table with the saledate and the service due dates, this way even while the system is working, the calls to the DB and back to the page will be very less expensive on the CPU, since PHP doesn't have to calculate a lot of things and doesn't have to browse through the entire DB with these calculated values. This way the draw back is that there might be more memory usage since there is a new table with data in it, but then the script only has to go through the page once every day. Correct me if my way of thinking on this was incorrect? Thanks, Vinay On Thu, Jun 21, 2012 at 4:46 PM, Toby Hart Dyke <toby@xxxxxxxxxxxx> wrote: The date_add() function is your friend here. You will need to define what happens when the start date is something like Nov 30th. When is the first service due after that? If you use date_add() to add three months, it will return March 1st (in a non-leap year). Your first step should be to define the business rules - what happens when a date doesn't exist (like February 30th)? Is it OK if the returned date is on a weekend? Or a holiday? Toby > -----Original Message----- > From: Vinay Kannan [mailto:vinykan@xxxxxxxxx] > Sent: Thursday, June 21, 2012 2:27 AM > To: php-windows@xxxxxxxxxxxxx; phpexperts@xxxxxxxxxxxxxxx; php mysql > Subject: Date Problem > > Hey Guys, > > I am working on a project for a client who is a retailer of inverters and > batteries, and currently the system records the salesdetails including the > warranty expiry date which is always a year(12 months). > > But he wishes to provide support and service every 3 months and that seems > to be the beginning of my problems :D > > if the warranty on billno ='100' expires on 2012-09-27, the system has to show > him this billno 4 times as a service due. > Eg: a product was sold and a bill generated on 2011-9-27, the warranty on the > products expires on 2012-9-27, so the system has to show the first service > due on 2011-12-27, then one on 2012-3-27, then on 2012-6-27. > > How do i go about it? > > Any help is much appreciated. > > Thanks,