Solved

Countdown to 2000

Posted on 1999-01-09
6
241 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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 50 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 130
Delphi selector screen 2 79
Downloading email attachments 2 74
Reconfigure Delphi Install? 2 51
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 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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 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