Solved

Timer question

Posted on 2001-07-09
5
192 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 166
Communication Between RC4 Delphi <-> PHP 3 123
Delphi: Connect to running MS Outlook 4 118
DBGrid or StringGrid ? 6 103
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 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