on 7/5/02 2:33 PM, joseph@xxxxxxxxxxxxxxxx purportedly said: > how do i compare the current date to a date field in my database > e.g. > $current_date = date('Y=m-d'); > $dbdate = pg_result($rsdate,0,"exam_date"); > if ($current_date>$dbdate) --THIS PART DOESNT WORK > echo "Today is not your exam date"; > TIA You have encountered what I consider one of the most annoying "features" if PHP. PHP is treating both values as strings, but when you do a comparison, PHP looks to see if the value looks like a number. If it does, it treats both as numbers, and discards any non-number portion. Because of this, chances are, you end up only comparing the years (everything after the first '-' is dropped). You have many options. Among them: 1) use stringcmp() 2) Make both into a number-looking string: date('Ymd') and str_replace( '-', '', $dbdate ) 3) convert to epochal time (seconds since epoch) using time() for current time, and strtotime to convert the db date. Note, however, that strtotime() cannot parse SQL dates because of the dashes. To get around this, you can: strtotime( str_replace( '-', '/', $dbdate ) ) Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"