The time Tdatetime is equivalent to double, that is, doubles the number 64 bits, finally found that it uses 11 bits to represent the precision of the e,53 bit (integer decimals together), the first one indicates positive or negative

Source: Internet
Author: User

Http://docwiki.embarcadero.com/RADStudio/Seattle/en/Internal_Data_Formats

About the RTL function of double, as if it were one: trystrtofloat

function trystrtofloat (const s:string; out value:double): Boolean; overload;
function trystrtofloat (const s:string; out value:double; Const formatsettings:tformatsettings): Boolean; overload;

Fortunately, it can also be converted in the specified format, good luck.

--------------------------------------------------------------------------------------------------------------- -----------

By the way, review the usage of the Absolute keyword:

functionDoubletohex (Constd:double):string;varOverlay:Array[1..2] ofLongintAbsoluteD;begin    Try        //"Little Endian" orderRESULT: = Inttohex (overlay[2],8) + Inttohex (overlay[1],8); except    End;End 

Where API function FileTimeToSystemTime fetch time, need to use Delphi to provide the Systemtimetodatetime function to do the conversion, To get the Delphi custom Tdatetime data (the date in Delphi is stored using a double type, the integer part represents the number of days from "1899-12-30", and the fractional part represents the hour.) such as "2.75" This value means "1900-1-1 6:00pm", "1.25" means "1899-12-29 AM")

functionGETFILETIMESUTC (ConstFileName:string): Tdatetime;varSystemtime:tsystemtime;    Finddata:win32_find_dataw;    Findhandle:thandle; fn:string;beginResult:=0; Findhandle:=Invalid_handle_value; Findhandle:=Findfirstfilew (Strchemintounicode (FN), FindData); ifFindhandle <> Invalid_handle_value Then        ifFileTimeToSystemTime (Finddata.ftlastwritetime, SystemTime) Then        beginResult:=Systemtimetodatetime (SystemTime); End; ifFindhandle <> Invalid_handle_value ThenWindows.findclose (findhandle);End;

Like this number:

2014-07-07, 09:31:25, after commissioning, the Tdatetime value in Delphi is: 41827.355157 (the number of days before the decimal point, the hour after the decimal point)

The time Tdatetime is equivalent to double, that is, doubles the number 64 bits, finally found that it uses 11 bits to represent the precision of the e,53 bit (integer decimals together), the first one indicates positive or negative

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.