Created
July 30, 2012 08:55
-
-
Save Simounet/3205723 to your computer and use it in GitHub Desktop.
mysql date comparison function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
static function mysql_timediff( $datefield, $date_to_compare, $tbl, $cond_field, $cond_value ) { | |
$db = eZDB::instance(); | |
$sql = "SELECT TIMEDIFF($datefield, $date_to_compare ) FROM $tbl WHERE $cond_field = '$cond_value';"; | |
$rows = $db->arrayQuery( $sql ); | |
return $rows[0]; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment