Date time Comparison

From: Date: Tue, 18 Apr 2006 22:02:43 +0000
Subject: Date time Comparison
Groups: php.general 
Request: Send a blank email to php-general+get-234227@lists.php.net to get a copy of this message
Hi everyone, this is the function I have written for comparing a date time please tell me if my logic is correct ? and if there's a better alternative please let me know of that as well. // This function will return 1 if supplied date is expired function is_expire($expiry_date){ $current_date=date('YmdHis'); $year=substr($expiry_date,0,4); $month=substr($expiry_date,5,2); $day=substr($expiry_date,8,2); $hour=substr($expiry_date,11,2); $min=substr($expiry_date,14,2); $sec=substr($expiry_date,17,2); $formated_expiry_date=$year.$month.$day.$hour.$min.$sec; if ($current_date>=$formated_expiry_date) return 1; else return 0; } -- Murtaza Chang

« previous php.general (#234227) next »