Solved

how to use time and date

Posted on 1998-09-07
6
153 Views
Last Modified: 2010-04-06
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
Comment
Question by:raslan
6 Comments
 

Author Comment

by:raslan
ID: 1338897
Edited text of question
0
 
LVL 2

Expert Comment

by:kjteng
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

by:
viktornet earned 150 total points
ID: 1338899
Add a timer to the form....set the Imterval to whatever valuie you want  1000 = 1sec
In OnTimer() add this code...
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 10

Expert Comment

by:viktornet
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

by:pjdb
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

by:viktornet
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now