Solved

# TdateTime Acurate

Posted on 1999-01-21
275 Views
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
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
• 3
• 2
• 2
• +1

Author Comment

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

LVL 17

Expert Comment

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

Regards Barry

0

Author Comment

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

LVL 20

Expert Comment

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.

0

Author Comment

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

ID: 1362717
if you use FormatDateTime you can see the difference...
0

LVL 2

Accepted Solution

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

ID: 1362719
hey that works nice
Regarsd Barry

0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
###### Suggested Courses
Course of the Month6 days, 8 hours left to enroll