20,359
社区成员
发帖
与我相关
我的任务
分享
strtotime("2015-01-26 09:00:00");
strtotime("2015-01-26 17:30:00");
时间戳不就来了么
create table ts_user
(wxname varchar(50) not null primary key,
name varchar(50) not null,
telnum char(11) not null unique,
email varchar(50) unique,
address varchar(100)
)ENGINE=InnoDB DEFAULT charset=utf8;
create table ts_signin
(signid int not null auto_increment primary key,
wxname varchar(50) not null,
sdate int(10) not null,
chidao int(1) default 0, // 1迟到,0没有迟到 int或bool 类型都行
edate int(10) not null,
zaotui int(1) default 0, //1早退,0没有早退,
location varchar(100) not null // 这是干嘛的不知道
)DEFAULT charset=utf8;
直接select count(chidao ) as chidaoa from ts_user,ts_signin, where ts_signin.wxname =ts_user.wxname and (1个月的判断)
类似这个就行,
每天加1条数据, 迟到,早退,都知道, 记得在每天晚上12点刷新, 没有签到,的,列为迟到, 或早退,插入数据段时候直接 写入chidao, 早退判断
echo date('h', strtotime("2015-01-27 09:01:10")); //9点
echo date('i', strtotime("2015-01-27 09:01:10"));//01分
// 获取时间的小时, H是24小时制 根据H来判断是否迟到,至于5点半的,再比较分钟就可以了吧,这样就不用每天都要生成时间戳了
date('H', $timestamp)