RE: Date Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux