Datetime field comparison incorrect
| From: | Casey Allen Shobe | Date: | Sun, 07 Jul 2002 04:17:40 +0000 |
| Subject: | Datetime field comparison incorrect | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20362@lists.php.net to get a copy of this message | ||
Hi,
I'm querying 2 datetime fields from a MSSQL database.
The format returned is 'Jul 06 2002 01:57PM' or similar.
I then try to do a comparison in PHP, to see if one is greater than the other.
The problem is that PHP believes 'Jul 06 2002 12:43PM' is greater than 'Jul 06
2002 01:08PM', which is obviously not true. Assuming that the first value
mentioned is $var1, and the second $var2, here's how I'm comparing:
if ($var1 > $var2) {
echo $var1.' is greater than '.$var2;
}
Thanks in advance,
--
Casey Allen Shobe / Network Security Analyst & PHP Developer
SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144
cshobe@secureworks.net / http://www.secureworks.net
Content is my own and does not necessarily represent my company.