I want to create an attendance system, in which the attendance based on following condition:
// Conditions
define('LATE_COND', '1306566960'); // strtotime(date('09:16:00'))
define('HALF_COND', '1306576860'); // strtotime(date('09:16:00'))
define('LATE_CODE', '#FC9E4B');
define('HALF_CODE', '#CCFF33');
define('PRESENT', 'PRESENT');
define('LATE', 'LATE');
define('HALF', 'HALF');
$time_in = strtotime(date('h:i:s'));
if($time_in <= LATE_COND){
$day_status = PRESENT;
$color_code = PRESENT_CODE;
}elseif( ($time_in >= LATE_COND) && ($attendance < HALF_COND) ){
$day_status = LATE;
$color_code = LATE_CODE;
}elseif($time_in >= HALF_COND){
$day_status = HALF;
$color_code = HALF_CODE;
}
but for strtotime(date('01:00:00')) value is '130653开发者_开发问答7200' and hence my all condition failed, any help and I want to do it using PHP5.x not mysql
strtotime
return epoch time. Which, if you don't already know, is the number of seconds passed since 1970. Now since you seem to be missing the date, as you are including only time, you can include date in it. date('Y-m-d h:i:s')
. Hope it helps.
精彩评论