Pages

Tuesday, January 17, 2012

Compare a timestamp field(Mysql) to date(PHP)

here is the where condition that should be added to your mysql qyery

where DATE_FORMAT(TimeStampFieldFromDatabase,"%Y-%m-%d")=$dateToBeCompared

Note:-$dateToBeCompared must be of type (Y-m-d) as per standard SQL format

use the DateTime PDO library class to convert the same format available in PHP 5.3.5

public string DateTime::format ( string $format )

No comments:

Post a Comment