Home > Back-end > How do the deiphi at 9 o 'clock in the morning to execute a program at 3 thank you
How do the deiphi at 9 o 'clock in the morning to execute a program at 3 thank you
Time:10-27
Can set the TIMER control interval is the interval is set to 300000 for 5 minutes, but can not specify the specific time, do I want to write a program to the customer then he need only after the operation was hanging on the server at 9 o 'clock to 3 o 'clock every day fixed every 5 minutes to perform a inserted into the database program, how to realize the thank you, very urgent
CodePudding user response:
Top off your post, thank you for your help!
CodePudding user response:
After the TIMER Settings, can timing judgment 09:00 & lt; The current time & lt; 15. 00, to perform the following actions,
CodePudding user response:
Take a time every 5 minutes, if the time between 9-3 points, will perform operations
CodePudding user response:
The interval or the default of 1000
Timer1Timer events: Var D: TDateTime; H, T: string; The begin D:=Now; H:=Formatdatetime (HH, D); T:=Formatdatetime (HHNN, D);
If (H> '9') and (H<'15') and (StrToInt (T) Mod 5=0) then The begin Timer1. Enabled:=False; //code execution, the execution after setting Enabled again=True; end; end;
CodePudding user response:
Application time for current system time when Var Cur_time: Tdatetime; Tem_time: Tdatetime; The begin If (formatdatetime (' mm: dd: ss ', now) & gt; '09:00:00) and (formatdatetime (' mm: dd: ss ', now) & lt; '15:00:00) then The begin Cur_time:=now; If datediff (s, cur_time temp_date)=5 then The begin Temp_date=cur_time; InsertdatatoDB (); end; end; end;
CodePudding user response:
Use DateDiff () function,
Description Returns the time interval between two dates, Syntax DateDiff (interval, date1 and date2 [, firstdayofweek [, firstweekofyear]]) DateDiff function grammar has the following parameters:
Parameter description Interval choice, string expression, said is used to calculate the time interval between date1 and date2, about values, please refer to the "Settings" section, Date1 and date2 choice, date expression, is used to calculate the two dates, Firstdayofweek optional, specify the first day of the week's constant, if not specified, the default for Sunday, about values, please refer to the "Settings" section, Firstweekofyear optional, constant specified in the first week of the year, if not specified, the default for January 1 week, about the number, please refer to the "Settings" section,
Set the The interval parameter can have the following values: Set the description Yyyy years
q quarterM on Y a year of days D day W week days Ww week H hours M minutes S second
CodePudding user response:
Write a program that insert, With plans to put the program task,
CodePudding user response:
Ask why the 4th floor TIME> 9 when less than 15 Timer1. Enabled:=False after and then execute the code and then Timer1. Enabled:=true,,,