Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

TdateTime Acurate

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
asi
Asked:
asi
  • 3
  • 2
  • 2
  • +1
1 Solution
 
asiAuthor Commented:
does 1/24 is exactly one hour (in TdateTime format) ?
10x
0
 
intheCommented:
what are you trying to do?
what does this do
Edit1.Text:=DateTimeToStr(Now);

Regards Barry

0
 
asiAuthor Commented:

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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
MadshiCommented:
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
 
asiAuthor Commented:
so what showd i do , in case that i want only milisocond ... (and look about the other  Comment,please)
0
 
lortegaCommented:
if you use FormatDateTime you can see the difference...
0
 
lortegaCommented:
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
 
intheCommented:
hey that works nice
Regarsd Barry

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now