Soap.XSBuiltIns.XMLTimeToDateTime

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function XMLTimeToDateTime(const XMLDateTime: InvString; AsUTCTime: Boolean = False): TDateTime;

C++

extern DELPHI_PACKAGE System::TDateTime __fastcall XMLTimeToDateTime(const System::UnicodeString XMLDateTime, bool AsUTCTime = false);

Properties

Type Visibility Source Unit Parent
function public
Soap.XSBuiltIns.pas
Soap.XSBuiltIns.hpp
Soap.XSBuiltIns Soap.XSBuiltIns

Description

Returns a TDateTime value for an XML date and time value. This function is the inverse of the DateTimeToXMLTime function.

XMLDateTime is a string with a date or a date and time in ISO 8601 format; for example: "2014-02-18T03:30:45+01:00". If the specified value is not correct, XMLTimeToDateTime raises an EConvertError exception: "Is not a valid date and time".

AsUTCTime is a boolean. If AsUTCTime is False (default), the date and time is in UTC, and time offsets ("+01:00" in the example above) are relative to UTC. Set AsUTCTime to True to parse the date and time as a local date and time, using the local time zone of the system running your application, and applying time offsets based on the local time zone as well.

For example, if you live in the Pacific Time Zone (UTC-08:00):

XMLDateTime AsUTCTime Result
2015-04-03T20:00:00 False 2015-04-03 12:00:00
2015-04-03T20:00:00 True 2015-04-03 20:00:00
2015-04-03T20:00:00+01:00 False 2015-04-03 11:00:00
2015-04-03T20:00:00+01:00 True 2015-04-03 19:00:00

See Also