Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# how to use time and date

Posted on 1998-09-07
Medium Priority
160 Views
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
0
Question by:raslan
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

Author Comment

ID: 1338897
Edited text of question
0

LVL 2

Expert Comment

ID: 1338898
Put a timer in the form and check the time at regular interval. Is this what you want?
0

LVL 10

Accepted Solution

viktornet earned 300 total points
ID: 1338899
Add a timer to the form....set the Imterval to whatever valuie you want  1000 = 1sec
procedure TFOrm1.TimerTimer1....
var
MyTime : TDateTime;
begin
MyTime := StrToTime('3:00am');
if Time >= MyTime then
begin
//Do you stuff here....it's already 3:00am...
end;
end;

Regards,
Viktor Ivanov
0

LVL 10

Expert Comment

ID: 1338900
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;

0

LVL 1

Expert Comment

ID: 1338901
WaitForSingleObject is *theorically* better :

Case WaitForSingleObject(Application.Handle, (DateTimeReActivation - Now) * 86400 * 1000) Of
//WAIT_ABANDONED:
//WAIT_OBJECT_0      :
WAIT_TIMEOUT:
{Action}
End;

JDB
0

LVL 10

Expert Comment

ID: 1338902
Hello???

Are oyu going to accept or reject my answer. Please do one of the two. Thanks

Regards,
Viktor Ivanov
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
###### Suggested Courses
Course of the Month9 days, 7 hours left to enroll