在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 procedure TForm1.Timer2Timer(Sender: TObject); 2 //delphi 时间触发事件 3 var 4 S,D:TDateTime; 5 ActiveHH:string;//触发小时 6 ActiveMM:string;//触发分 7 ActiveSS:string;//触发秒 8 begin 9 s:=strtodatetime(FormatDateTime('hh:mm:ss',Now));//时间 10 11 ActiveHH :=Edit3.Text;//时 12 ActiveMM :=Edit4.Text;//分 13 ActiveSS :=Edit5.Text; //秒 14 15 16 D:=strtodatetime(ActiveHH +':' + ActiveMM + ':' + ActiveSS); //到时间 17 18 //当日期为当天就触发 19 if FormatDateTime('YYYY-MM-DD ',DateTimePicker2.date) = FormatDateTime('YYYY-MM-DD ',now) then 20 begin 21 if s=d then //当时间一样就触发 22 begin 23 showmessage('电脑爆了!'); 24 // 这中间你加入你自己要 执行的数据库语句 25 end; 26 end; 27 28 end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论