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:
• 3
• 2
• 2
• +1
1 Solution

Author Commented:
does 1/24 is exactly one hour (in TdateTime format) ?
10x
0

Commented:
what are you trying to do?
what does this do
Edit1.Text:=DateTimeToStr(Now);

Regards Barry

0

Author 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

Commented:
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 Commented:
so what showd i do , in case that i want only milisocond ... (and look about the other  Comment,please)
0

Commented:
if you use FormatDateTime you can see the difference...
0

Commented:
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

Commented:
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.

## Featured Post

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