Re: Date/time comparison...
| From: | Pablo Vera | Date: | Mon, 28 Aug 2000 15:32:05 +0000 |
| Subject: | Re: Date/time comparison... | ||
| References: | 1 | Groups: | php.db php.windows |
| Request: | Send a blank email to php-db+get-2418@lists.php.net to get a copy of this message | ||
Monday, August 28, 2000, 5:17:44 AM, Jeroen wrote:
JtB> So it should look something like :
JtB> If (PurchaseDate > CurrentDate - XDays and PurchaseDate < CurrentDate)
JtB> {
JtB> strTemp="New unit";
JtB> }
JtB> else
JtB> {
JtB> if (PurchaseDate < CurrentDate - YMonths)
JtB> {
JtB> strTemp="No warranty";
JtB> }
JtB> else
JtB> {
JtB> strTemp="Refurbished";
JtB> }
JtB> }
Jeroen:
I don't know exactly what your question is, but I would do
something like this:
If (PurchaseDate + XDays > CurrentDate)
{
strTemp="New unit";
}
elseif (PurchaseDate + YMonths > CurrentDate)
{
strTemp="Refurbished";
}
else
{
strTemp="No warranty";
}
Just make sure that PurchaseDate, CurrentDate, XDays and YMonths are
all in the same time unit (ie. seconds, days, etc.). If you store the
date as a string, a better format is "yyyy-mm-dd", because you can
sort it correctly.
Saludos,
Pablo Vera