raslan
asked on
how to use time and date
how to insert TIME AND DATE in a form and use it in our application(example i need to run a function at 3:00 AM on monday )
please i need the full procedure + an example
please i need the full procedure + an example
Put a timer in the form and check the time at regular interval. Is this what you want?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is the full procedure.......
procedure TForm1.Timer1Timer(Sender: TObject);
var
MyTime : TDateTime;
begin
MyTime := StrToTime('3:00am');
if (Time >= MyTime) and (DayOfWeek(Date) = 2) then//Sunday = 1, Monday = 2
begin
timer1.enabled := false;
ShowMessage('Hello there, it''s 3:00am');
end;
end;
procedure TForm1.Timer1Timer(Sender:
var
MyTime : TDateTime;
begin
MyTime := StrToTime('3:00am');
if (Time >= MyTime) and (DayOfWeek(Date) = 2) then//Sunday = 1, Monday = 2
begin
timer1.enabled := false;
ShowMessage('Hello there, it''s 3:00am');
end;
end;
WaitForSingleObject is *theorically* better :
Case WaitForSingleObject(Applic ation.Hand le, (DateTimeReActivation - Now) * 86400 * 1000) Of
//WAIT_ABANDONED:
//WAIT_OBJECT_0 :
WAIT_TIMEOUT:
{Action}
End;
JDB
Case WaitForSingleObject(Applic
//WAIT_ABANDONED:
//WAIT_OBJECT_0 :
WAIT_TIMEOUT:
{Action}
End;
JDB
Hello???
Are oyu going to accept or reject my answer. Please do one of the two. Thanks
Regards,
Viktor Ivanov
Are oyu going to accept or reject my answer. Please do one of the two. Thanks
Regards,
Viktor Ivanov
ASKER