Changeset 40 for trunk/Common/USqlDatabase.pas
- Timestamp:
- Nov 17, 2010, 7:38:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/USqlDatabase.pas
r38 r40 8 8 9 9 uses 10 SysUtils, Classes, Dialogs, mysql50, TypInfo, UStringListEx,11 ListObject, DictionaryStringString;10 SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedObjectList, 11 SpecializedDictionary, SpecializedList; 12 12 13 13 type … … 113 113 end; 114 114 115 function StrToStr(Value: string): string; 116 begin 117 Result := Value; 118 end; 119 115 120 function SQLToDateTime(Value: string): TDateTime; 116 121 var 117 Parts: T StringListEx;118 DateParts: T StringListEx;119 TimeParts: T StringListEx;120 begin 121 try 122 Parts := T StringListEx.Create;123 DateParts := T StringListEx.Create;124 TimeParts := T StringListEx.Create;125 126 Parts.Explode( ' ', Value);127 DateParts.Explode( '-', Parts[0]);122 Parts: TListString; 123 DateParts: TListString; 124 TimeParts: TListString; 125 begin 126 try 127 Parts := TListString.Create; 128 DateParts := TListString.Create; 129 TimeParts := TListString.Create; 130 131 Parts.Explode(Value, ' ', StrToStr); 132 DateParts.Explode(Parts[0], '-', StrToStr); 128 133 Result := EncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]), 129 134 StrToInt(DateParts[2])); 130 135 if Parts.Count > 1 then begin 131 TimeParts.Explode( ':', Parts[1]);136 TimeParts.Explode(Parts[1], ':', StrToStr); 132 137 Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]), 133 138 StrToInt(TimeParts[2]), 0);
Note:
See TracChangeset
for help on using the changeset viewer.