?
Solved

Countdown to 2000

Posted on 1999-01-09
6
Medium Priority
?
246 Views
Last Modified: 2010-04-06
I'm looking to code a 2000 countdown timer.
Do you have any design advice ?
Have I to use label component and thread ? Or what else ?
I use TDate  component. Then I calculate the days to the 1/1/2000 How can I print the TDate value as dd/mm/yy hh:mm:ss ? I try with DateToStr but it's a value like dd/mm/yy.
0
Comment
Question by:borgo
[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
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1355527
Hmmm. I think it could be a small window with "formStyle:=fsStayOnTop" and either with a toolWindows borderStyle or with no border at all.
You could use a label component. But I would suggest a simple TTimer object to do the work. Normally you don't need a thread for this.
Then you could use the function DateTimeToSystemTime, which converts TDateTime to TSystemTime.
type
  TSystemTime = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
Then you can format the string yourself.

More questions? Please ask...  :-)

Regards, Madshi.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1355528
hi borgo,

in addition to madshi a year 2000 Countdown

procedure TForm1.Timer1Timer(Sender: TObject);
Var
  R : Real;
begin
  r := StrToDateTime('01/01/2000 00:00:00') - Now;
  Label1.caption := FloatToStr(Int(r)) + ' Days ' +TimeToStr(r);
end;

meikl
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355529
Hi meikl, looks nice...  :-)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:borgo
ID: 1355530
Thank you Madshi.
But I find that the kretzschmar's answer is easier than yours.


0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355531
No prob...
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 1355532
Hi Borgo,
you can the year2000 also place in a constant

const
  Y2000 = 36526; {the Value of 01/01/2000 00:00:00}

procedure TForm1.Timer1Timer(Sender: TObject);
Var
  R : Real;
begin
  r := Y2000 - Now;
  Label1.caption := FloatToStr(Int(r)) + ' Days ' +TimeToStr(r);
end;

meikl
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
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…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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