In Delphi is there a function to convert XML date and time to TDateTime

前端 未结 3 2001
别那么骄傲
别那么骄傲 2020-12-13 05:10

XML date and time are in the format

\'-\'? yyyy \'-\' mm \'-\' dd \'T\' hh \':\' mm \':\' ss (\'.\' s+)? (zzzzzz)?

were

•\'-\'? yy

3条回答
  •  醉酒成梦
    2020-12-13 05:33

    OmniXML's unit OmniXMLUtils contains bunch of funcions to do XML to date and date to XML conversions.

    function XMLStrToDateTime(nodeValue: XmlString; var value: TDateTime): boolean; overload;
    function XMLStrToDateTime(nodeValue: XmlString): TDateTime; overload;
    function XMLStrToDateTimeDef(nodeValue: XmlString; defaultValue: TDateTime): TDateTime;
    function XMLStrToDate(nodeValue: XmlString; var value: TDateTime): boolean; overload;
    function XMLStrToDate(nodeValue: XmlString): TDateTime; overload;
    function XMLStrToDateDef(nodeValue: XmlString; defaultValue: TDateTime): TDateTime;
    function XMLStrToTime(nodeValue: XmlString; var value: TDateTime): boolean; overload;
    function XMLStrToTime(nodeValue: XmlString): TDateTime; overload;
    function XMLStrToTimeDef(nodeValue: XmlString; defaultValue: TDateTime): TDateTime;
    
    function XMLDateTimeToStr(value: TDateTime): XmlString;
    function XMLDateTimeToStrEx(value: TDateTime): XmlString;
    function XMLDateToStr(value: TDateTime): XmlString;
    function XMLTimeToStr(value: TDateTime): XmlString;
    

提交回复
热议问题