Inverse function of FormatDateTime

后端 未结 7 625
自闭症患者
自闭症患者 2021-02-07 04:38

I am looking for a function to reverse any string (YYYYMDD,YY/MM/DD,YYMMDD,...) created by the function FormatDateTime to

7条回答
  •  野的像风
    2021-02-07 05:04

    It is quite easy with existing solution, StrToDateFmt function in rxDateutil.pas unit from RX package, which can be downloaded here: http://sourceforge.net/projects/rxlib/

    EDIT:

    Mentioned above function and StrToDateFmt from rxDateutil.pas are doing exactly what you expect, converting string to datetime using specified string mask, the code is too large to be included as this unit contains also other date functions, some of them required for converting string to date.

    Example of use:

    Result := StrToDateFmtDef('MM/DD/YYYY', '11/11/2011', Now);
    

提交回复
热议问题