Solved

Timer question

Posted on 2001-07-09
5
189 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
Comment Utility
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
Comment Utility
Sorry, that should be 'add' not 'ass'

The Neil =:)
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
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
Comment Utility
Hi systemop,

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

-----
Igor.
0
 

Author Comment

by:systemop
Comment Utility
Thanks man youre my hero..
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

11 Experts available now in Live!

Get 1:1 Help Now