Reply to Re: [PHP] date comparisions...

Your name:

Reply:


Posted by Richard Davey on 10/07/05 21:46

Hi aaronjw,

Friday, October 7, 2005, 7:34:11 PM, you wrote:

> if ($discountResult["dateexpired"] > date("U"))
> {

> //dosomething

> }
> else
> {

> //do something else

> }

> Anyway... it's supposed to read: IF the expired date is past the current
> date... disallow "dosomething" otherwise... let it go.

> I set the expire date to be Sept 30, 2005 and obviously today is the
> current date but for some reason the "dosomething" is being allowed.

Start with the obvious - what actually IS the value of
$discountResult["dateexpired"]? var_dump it out and have a look. Check
you are comparing like with like. You're also not performing a strict
comparison, so string conversion could be going on here.

The other obvious fact is that if dateexpired is less than *right
now*, it'll always "dosomething" ! :)

Cheers,

Rich
--
Zend Certified Engineer
http://www.launchcode.co.uk

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация