Solved

Timer question

Posted on 2001-07-09
5
190 Views
Last Modified: 2010-04-06
I want my Label1 shows now + 25 min. How can i do this?

When i do TimeToStr(Now) + 25 it gives error??
0
Comment
Question by:systemop
5 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 30 total points
ID: 6264189
TDateTime is a float value. The integer part gives the day and the decimal part gives the time. To add 25 minutes then you need to do this:

Label1.Caption := TimeToStr(Now + EncodeTime(0, 25, 0, 0));

You can't just ass 25 straight onto the time as that's not how it works. The above does

The Neil =:)
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 6264193
Sorry, that should be 'add' not 'ass'

The Neil =:)
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6264196
procedure TForm1.Button1Click(Sender: TObject);
var
  Hour, Min, Sec, MSec: Word;
 begin
  DecodeTime(Time,Hour,Min,Sec,MSec);
  Label1.Caption :=IntToStr(Hour) + ':' + IntToStr(Min + 25) + ':' + IntToStr(Sec);
end;
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6264208
Hi systemop,

const
  OneHour = 1/24;
  OneMin = OneHour / 60;
....
TimeToStr(Now+ 25*OneMin)  

-----
Igor.
0
 

Author Comment

by:systemop
ID: 6264236
Thanks man youre my hero..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wininet read php file from internet issue 6 81
Multiple image collision 13 69
Performance of SQL statement 37 98
Delphi...Split view - idea? 1 42
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 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…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 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

15 Experts available now in Live!

Get 1:1 Help Now