Date time Comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux