Archived Forum Post

Index of archived forum posts

Question:

Conversion issues

Jul 16 '13 at 00:39

I am using FTP2 with Delphi Dll. How do I convert the value of CkFtp2_GetLastModDt() to String or TDateTime ?


Answer

To get it as a string in RFC822 format, you would instead call CkFtp2__getLastModifiedTimeStr. Notice that each function that returns a string has two forms. One has a double underscore followed by the lowercase function name and returns the string directly. The other has a single underscore and uses the uppercase name, and returns the string in a HCkString. This is the convention for all Chilkat DLL functions that return strings:

function CkFtp2__getLastModifiedTimeStr(objHandle: HCkFtp2; 
    index: Integer): PWideChar; stdcall; 

function CkFtp2_GetLastModifiedTimeStr(objHandle: HCkFtp2; index: Integer; outStr: HCkString): Boolean; stdcall;


Answer

The CkFtp2_GetLastModDt method returns a CkDateTime object via a handle (HCkDateTime). At the moment I'm writing this, I don't know how to get it as a TDateTime, but this is what you would do (and I'm about to do it...) You first look at the HCkDateTime API to see what date/time representations it is capable of returning, and then you look at the TDateTime documentation to see what date/time formats/representations it's capable of using for setting or creating an object instance. If you find a common format, then you would get the date/time in that format from HCkDateTime, and use it to load/set/create a TDateTime object.