How do I convert an ISO 8601 string to a Delphi TDate?

前端 未结 7 1500
北海茫月
北海茫月 2020-12-06 05:09

I can convert a Delphi TDate to ISO 8601 format easily using this:

DateTimeToString(result, \'yyyy-mm-dd\', myDate);

What\'s the idiomatic

7条回答
  •  隐瞒了意图╮
    2020-12-06 05:26

    USES Soap.XSBuiltIns;
    ...
    Function XMLDateTimeToLocalDateTime(const Value: String): TDateTime;
    begin
      with TXSDateTime.Create do
      try
        XSToNative(Value);
        result := AsDateTime;
      finally
        Free;
      end;
    end;
    

    Delphi XE3

提交回复
热议问题