Solved

TdateTime Acurate

Posted on 1999-01-21
8
277 Views
Last Modified: 2010-04-06
hi
i have to var type TdateTime there value is 35983.0833333333285 35983.0833333333333 but there DateTimeToStr are the same , why is that ?
what should i do to prevent it ?
10x
Asi
0
Comment
Question by:asi
[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
  • 2
  • +1
8 Comments
 

Author Comment

by:asi
ID: 1362712
does 1/24 is exactly one hour (in TdateTime format) ?
10x
0
 
LVL 17

Expert Comment

by:inthe
ID: 1362713
what are you trying to do?
what does this do
Edit1.Text:=DateTimeToStr(Now);

Regards Barry

0
 

Author Comment

by:asi
ID: 1362714

if the last unswer is yes
why does look at the value of this one frac(StrToDateTime('11/11/11 01:00:00'))  are not equal to 1/24 (according to delphi) ?

and for inthe :
i"m tring to understand why to Variable from the same type that suppose to show the exact value are not .....

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:Madshi
ID: 1362715
There's more in a TDateTime than just seconds. There are milliseconds in it, too. And they are not included in the string.

Regards, Madshi.
0
 

Author Comment

by:asi
ID: 1362716
so what showd i do , in case that i want only milisocond ... (and look about the other  Comment,please)
0
 
LVL 2

Expert Comment

by:lortega
ID: 1362717
if you use FormatDateTime you can see the difference...
0
 
LVL 2

Accepted Solution

by:
lortega earned 30 total points
ID: 1362718
if you want to use milisecond for any kind of comparison or
just random numbers then use DecodeTime...

procedure TForm1.Button1Click(Sender: TObject);

var
  Present: TDateTime;
  Hour, Min, Sec, MSec: Word;
 begin
  Present:= Now;    {or the variable that you want...}
  DecodeTime(Present, Hour, Min, Sec, MSec);
  Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour ' + IntToStr(Hour);
end;


good luck,
luis

0
 
LVL 17

Expert Comment

by:inthe
ID: 1362719
hey that works nice
Regarsd Barry

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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