--------------------------------------------------------------------------- s = "yyyy[mm[dd[Thh[nn[ss[.zzzz]]]]]]"
| 1923 | //--------------------------------------------------------------------------- |
| 1924 | // s = "yyyy[mm[dd[Thh[nn[ss[.zzzz]]]]]]" |
| 1925 | TDateTime DateTimeFromISO8601(String s) |
| 1926 | { |
| 1927 | int l = s.Length(); |
| 1928 | unsigned short year, month=0, day=0; |
| 1929 | unsigned short hour=0, min=0, sec=0, msec=0; |
| 1930 | |
| 1931 | if( l<4 ) |
| 1932 | throw Exception(AnsiString("DateTimeFromISO8601(): �������� ���� �����: ") + s); |
| 1933 | |
| 1934 | year = StrToInt(s.SubString(1,4)); |
| 1935 | if( l>=6 ) month = StrToInt(s.SubString(5,2)); |
| 1936 | if( l>=8 ) day = StrToInt(s.SubString(7,2)); |
| 1937 | if( l>=11 ) |
| 1938 | if( s[9]=='T' ) |
| 1939 | { |
| 1940 | hour = StrToInt(s.SubString(10,2)); |
| 1941 | if( l>=13 ) min = StrToInt(s.SubString(12,2)); |
| 1942 | if( l>=15 ) sec = StrToInt(s.SubString(14,2)); |
| 1943 | if( l>=20 ) if( s[16]=='.' ) msec = StrToInt(s.SubString(17,3)); |
| 1944 | } |
| 1945 | return TDateTime(year, month, day) + TDateTime(hour, min, sec, msec); |
| 1946 | } |
| 1947 | //--------------------------------------------------------------------------- |
| 1948 | bool StringStartWith(String Str, String StartStr) |
| 1949 | { |
nothing calls this directly
no outgoing calls
no test coverage detected