dati.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. {
  2. *********************************************************************
  3. $Id$
  4. Copyright (C) 1997, 1998 Gertjan Schouten
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. *********************************************************************
  17. System Utilities For Free Pascal
  18. }
  19. {==============================================================================}
  20. { internal functions }
  21. {==============================================================================}
  22. const
  23. DayTable: array[Boolean, 1..12] of longint =
  24. ((0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334),
  25. (0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335));
  26. function DoEncodeDate(Year, Month, Day: Word): longint;
  27. var c, ya: word;
  28. begin
  29. if (Month > 0) and (Month < 13) and (Day > 0) and (Day < 32) then
  30. begin
  31. if month > 2 then Month := Month - 3 else
  32. begin
  33. Month := Month + 9;
  34. Year:= Year - 1;
  35. end;
  36. c:= Year DIV 100;
  37. ya:= Year - 100*c;
  38. result := (146097*c) SHR 2 + (1461*ya) SHR 2 + (153*Month+2) DIV 5 + Day -
  39. 693901;
  40. end else result:=0;
  41. end;
  42. function DoEncodeTime(Hour, Minute, Second, MilliSecond: word): longint;
  43. begin
  44. If ((hour>=0) and (Hour<24)) and
  45. ((Minute>=0) and (Minute<60)) and
  46. ((Second>=0) and (Second<60)) and
  47. ((MilliSecond>=0) and (Millisecond<1000)) then
  48. Result := (Hour * 3600000 + Minute * 60000 + Second * 1000 + MilliSecond)
  49. else
  50. Result:=0;
  51. end ;
  52. {==============================================================================}
  53. { Public functions }
  54. {==============================================================================}
  55. { DateTimeToTimeStamp converts DateTime to a TTimeStamp }
  56. function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
  57. begin
  58. result.Time := Trunc(Frac(DateTime) * MSecsPerDay);
  59. result.Date := 1
  60. + DateDelta
  61. + Trunc(System.Int(DateTime));
  62. end ;
  63. { TimeStampToDateTime converts TimeStamp to a TDateTime value }
  64. function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
  65. begin
  66. result := (TimeStamp.Date - DateDelta - 1) + (TimeStamp.Time / MSecsPerDay);
  67. end ;
  68. { MSecsToTimeStamp }
  69. function MSecsToTimeStamp(MSecs: comp): TTimeStamp;
  70. begin
  71. result.Date := trunc(msecs / msecsperday);
  72. msecs:= msecs - comp(result.date * msecsperday);
  73. result.Time := Trunc(MSecs);
  74. end ;
  75. { TimeStampToMSecs }
  76. function TimeStampToMSecs(const TimeStamp: TTimeStamp): comp;
  77. begin
  78. result := TimeStamp.Time + timestamp.date*msecsperday;
  79. end ;
  80. { EncodeDate packs three variables Year, Month and Day into a
  81. TDateTime value the result is the number of days since 12/30/1899 }
  82. function EncodeDate(Year, Month, Day: word): TDateTime;
  83. begin
  84. result := DoEncodeDate(Year, Month, Day);
  85. end ;
  86. { EncodeTime packs four variables Hour, Minute, Second and MilliSecond into
  87. a TDateTime value }
  88. function EncodeTime(Hour, Minute, Second, MilliSecond:word):TDateTime;
  89. begin
  90. Result := DoEncodeTime(hour, minute, second, millisecond) / MSecsPerDay;
  91. end ;
  92. { DecodeDate unpacks the value Date into three values:
  93. Year, Month and Day }
  94. procedure DecodeDate(Date: TDateTime; var Year, Month, Day: word);
  95. var
  96. j: word;
  97. begin
  98. j := pred((Trunc(System.Int(Date)) + 693901) SHL 2);
  99. Year:= j DIV 146097;
  100. j:= j - 146097 * Year;
  101. Day := j SHR 2;
  102. j:=(Day SHL 2 + 3) DIV 1461;
  103. Day:= (Day SHL 2 + 7 - 1461*j) SHR 2;
  104. Month:=(5 * Day-3) DIV 153;
  105. Day:= (5 * Day +2 - 153*Month) DIV 5;
  106. Year:= 100 * Year + j;
  107. if Month < 10 then Month:= Month + 3 else begin
  108. Month:= Month-9;
  109. inc(Year);
  110. end;
  111. end ;
  112. { DecodeTime unpacks Time into four values:
  113. Hour, Minute, Second and MilliSecond }
  114. procedure DecodeTime(Time: TDateTime; var Hour, Minute, Second, MilliSecond: word);
  115. Var l : longint;
  116. begin
  117. l := Trunc(Frac(time) * MSecsPerDay);
  118. Hour := l div 3600000;
  119. l := l mod 3600000;
  120. Minute := l div 60000;
  121. l := l mod 60000;
  122. Second := l div 1000;
  123. l := l mod 1000;
  124. MilliSecond := l;
  125. {
  126. Time := Frac(Time) * 24;
  127. Hour := Trunc(Time);
  128. Time := Frac(Time) * 60;
  129. Minute := Trunc(Time);
  130. Time := Frac(Time) * 60;
  131. Second := Trunc(Time);
  132. MilliSecond := Trunc(Frac(Time) * 1000);
  133. }
  134. end;
  135. { DateTimeToSystemTime converts DateTime value to SystemTime }
  136. procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);
  137. begin
  138. DecodeDate(DateTime, SystemTime.Year, SystemTime.Month, SystemTime.Day);
  139. DecodeTime(DateTime, SystemTime.Hour, SystemTime.Minute, SystemTime.Second, SystemTime.MilliSecond);
  140. end ;
  141. { SystemTimeToDateTime converts SystemTime to a TDateTime value }
  142. function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
  143. begin
  144. result := DoEncodeDate(SystemTime.Year,
  145. SystemTime.Month,
  146. SystemTime.Day) +
  147. DoEncodeTime(SystemTime.Hour,
  148. SystemTime.Minute,
  149. SystemTime.Second,
  150. SystemTime.MilliSecond) / MSecsPerDay;
  151. end ;
  152. { DayOfWeek returns the Day of the week (sunday is day 1) }
  153. function DayOfWeek(DateTime: TDateTime): integer;
  154. begin
  155. Result := 1 + (Trunc(DateTime) mod 7);
  156. end ;
  157. { Date returns the current Date }
  158. function Date: TDateTime;
  159. var SystemTime: TSystemTime;
  160. begin
  161. GetLocalTime(SystemTime);
  162. result := DoEncodeDate(SystemTime.Year,
  163. SystemTime.Month,
  164. SystemTime.Day);
  165. end ;
  166. { Time returns the current Time }
  167. function Time: TDateTime;
  168. var SystemTime: TSystemTime;
  169. begin
  170. GetLocalTime(SystemTime);
  171. Result := DoEncodeTime(SystemTime.Hour,
  172. SystemTime.Minute,
  173. SystemTime.Second,
  174. SystemTime.MilliSecond) / MSecsPerDay;
  175. end ;
  176. { Now returns the current Date and Time }
  177. function Now: TDateTime;
  178. var SystemTime: TSystemTime;
  179. begin
  180. GetLocalTime(SystemTime);
  181. result := DoEncodeDate(SystemTime.Year,
  182. SystemTime.Month,
  183. SystemTime.Day) +
  184. DoEncodeTime(SystemTime.Hour,
  185. SystemTime.Minute,
  186. SystemTime.Second,
  187. SystemTime.MilliSecond) / MSecsPerDay;
  188. end ;
  189. { IncMonth increments DateTime with NumberOfMonths months,
  190. NumberOfMonths can be less than zero }
  191. function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer): TDateTime;
  192. var Year, Month, Day: word;
  193. S : Integer;
  194. begin
  195. If NumberOfMonths>=0 then s:=1 else s:=-1;
  196. DecodeDate(DateTime, Year, Month, Day);
  197. Year := Year + (NumberOfMonths div 12);
  198. Month := Month + (NumberOfMonths mod 12)-1 ; // Mod result always positive
  199. if Month>11 then begin
  200. Dec(Month, S*12);
  201. Inc(Year, S);
  202. end ;
  203. Inc(Month, 1); { Months from 1 to 12 }
  204. if (Month = 2) and (IsLeapYear(Year)) and (Day > 28) then
  205. Day := 28;
  206. result := Frac(DateTime) + DoEncodeDate(Year, Month, Day);
  207. end ;
  208. { IsLeapYear returns true if Year is a leap year }
  209. function IsLeapYear(Year: Word): boolean;
  210. begin
  211. Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
  212. end;
  213. { DateToStr returns a string representation of Date using ShortDateFormat }
  214. function DateToStr(Date: TDateTime): string;
  215. begin
  216. result := FormatDateTime('ddddd', Date);
  217. end ;
  218. { TimeToStr returns a string representation of Time using ShortTimeFormat }
  219. function TimeToStr(Time: TDateTime): string;
  220. begin
  221. result := FormatDateTime('t', Time);
  222. end ;
  223. { DateTimeToStr returns a string representation of DateTime using ShortDateTimeFormat }
  224. function DateTimeToStr(DateTime: TDateTime): string;
  225. begin
  226. result := FormatDateTime('c', DateTime);
  227. end ;
  228. { StrToDate converts the string S to a TDateTime value
  229. if S does not represent a valid date value
  230. an EConvertError will be raised }
  231. function StrToDate(const S: string): TDateTime;
  232. var
  233. df:string;
  234. d,m,y:word;
  235. n,i:longint;
  236. c:word;
  237. dp,mp,yp,which : Byte;
  238. s1:string[4];
  239. values:array[0..2] of longint;
  240. LocalTime:tsystemtime;
  241. begin
  242. df := UpperCase(ShortDateFormat);
  243. { Determine order of D,M,Y }
  244. Which:=0;
  245. For I:=1 to Length(df) do
  246. Case df[i] of
  247. 'Y' : yp:=which;
  248. 'M' : mp:=which;
  249. 'D' : dp:=which;
  250. else
  251. If df[i]=DateSeparator then
  252. Inc(Which);
  253. end;
  254. { Get actual values }
  255. for i := 0 to 2 do values[i] := 0;
  256. s1 := '';
  257. n := 0;
  258. for i := 1 to length(s) do begin
  259. if (s[i] in ['0'..'9']) then s1 := s1 + s[i];
  260. if (s[i] in [dateseparator,' ']) or (i = length(s)) then begin
  261. val(s1, values[n], c);
  262. if c<>0 then
  263. Raise EConvertError.Create('Invalid date format');
  264. s1 := '';
  265. inc(n);
  266. end ;
  267. end ;
  268. // Fill in values.
  269. If N=3 then
  270. begin
  271. y:=values[yp];
  272. m:=values[mp];
  273. d:=values[dp];
  274. end
  275. Else
  276. begin
  277. getLocalTime(LocalTime);
  278. y := LocalTime.Year;
  279. If n<2 then
  280. begin
  281. d:=values[0];
  282. m := LocalTime.Month;
  283. end
  284. else
  285. If dp<mp then
  286. begin
  287. d:=values[0];
  288. m:=values[1];
  289. end
  290. else
  291. begin
  292. d:=values[1];
  293. m:=values[0];
  294. end;
  295. end;
  296. if (y >= 0) and (y < 100) then y := 1900 + y;
  297. Result := DoEncodeDate(y, m, d);
  298. end ;
  299. { StrToTime converts the string S to a TDateTime value
  300. if S does not represent a valid time value an
  301. EConvertError will be raised }
  302. function StrToTime(const s: string): TDateTime;
  303. var
  304. Len, Current: integer; PM: boolean;
  305. function GetElement: integer;
  306. var
  307. j: integer; c: word;
  308. begin
  309. result := -1;
  310. Inc(Current);
  311. while (result = -1) and (Current < Len) do begin
  312. if S[Current] in ['0'..'9'] then begin
  313. j := Current;
  314. while (Current < Len) and (s[Current + 1] in ['0'..'9']) do
  315. Inc(Current);
  316. val(copy(S, j, 1 + Current - j), result, c);
  317. end
  318. else if (S[Current] = TimeAMString[1]) or (S[Current] in ['a', 'A']) then begin
  319. Current := 1 + Len;
  320. end
  321. else if (S[Current] = TimePMString[1]) or (S[Current] in ['p', 'P']) then begin
  322. Current := 1 + Len;
  323. PM := True;
  324. end
  325. else if (S[Current] = TimeSeparator) or (S[Current] = ' ') then
  326. Inc(Current)
  327. else
  328. raise EConvertError.Create('Invalid Time format');
  329. end ;
  330. end ;
  331. var
  332. i: integer;
  333. TimeValues: array[0..4] of integer;
  334. begin
  335. Current := 0;
  336. Len := length(s);
  337. PM := False;
  338. for i:=0 to 4 do
  339. timevalues[i]:=0;
  340. i := 0;
  341. TimeValues[i] := GetElement;
  342. while (i < 5) and (TimeValues[i] <> -1) do begin
  343. i := i + 1;
  344. TimeValues[i] := GetElement;
  345. end ;
  346. If (i<5) and (TimeValues[I]=-1) then
  347. TimeValues[I]:=0;
  348. if PM then Inc(TimeValues[0], 12);
  349. result := EncodeTime(TimeValues[0], TimeValues[1], TimeValues[2], TimeValues[3]);
  350. end ;
  351. { StrToDateTime converts the string S to a TDateTime value
  352. if S does not represent a valid date and time value
  353. an EConvertError will be raised }
  354. function StrToDateTime(const s: string): TDateTime;
  355. var i: integer;
  356. begin
  357. i := pos(' ', s);
  358. if i > 0 then result := StrToDate(Copy(S, 1, i - 1)) + StrToTime(Copy(S, i + 1, length(S)))
  359. else result := StrToDate(S);
  360. end ;
  361. { FormatDateTime formats DateTime to the given format string FormatStr }
  362. function FormatDateTime(FormatStr: string; DateTime: TDateTime): string;
  363. var
  364. ResultLen: integer;
  365. ResultBuffer: array[0..255] of char;
  366. ResultCurrent: pchar;
  367. procedure StoreStr(Str: pchar; Len: integer);
  368. begin
  369. if ResultLen + Len < SizeOf(ResultBuffer) then begin
  370. StrMove(ResultCurrent, Str, Len);
  371. ResultCurrent := ResultCurrent + Len;
  372. ResultLen := ResultLen + Len;
  373. end ;
  374. end ;
  375. procedure StoreString(const Str: string);
  376. var Len: integer;
  377. begin
  378. Len := Length(Str);
  379. if ResultLen + Len < SizeOf(ResultBuffer) then begin
  380. StrMove(ResultCurrent, pchar(Str), Len);
  381. ResultCurrent := ResultCurrent + Len;
  382. ResultLen := ResultLen + Len;
  383. end;
  384. end;
  385. procedure StoreInt(Value, Digits: integer);
  386. var S: string; Len: integer;
  387. begin
  388. S := IntToStr(Value);
  389. Len := Length(S);
  390. if Len < Digits then begin
  391. S := copy('0000', 1, Digits - Len) + S;
  392. Len := Digits;
  393. end ;
  394. StoreStr(pchar(@S[1]), Len);
  395. end ;
  396. Function TimeReFormat(Const S : string) : string;
  397. // Change m into n for time formatting.
  398. Var i : longint;
  399. begin
  400. Result:=S;
  401. For I:=1 to Length(Result) do
  402. If Result[i]='m' then
  403. result[i]:='n';
  404. end;
  405. var
  406. Year, Month, Day, DayOfWeek, Hour, Minute, Second, MilliSecond: word;
  407. procedure StoreFormat(const FormatStr: string);
  408. var
  409. Token: char;
  410. FormatCurrent: pchar;
  411. FormatEnd: pchar;
  412. Count: integer;
  413. Clock12: boolean;
  414. P: pchar;
  415. begin
  416. FormatCurrent := Pchar(FormatStr);
  417. FormatEnd := FormatCurrent + Length(FormatStr);
  418. Clock12 := false;
  419. P := FormatCurrent;
  420. while P < FormatEnd do begin
  421. Token := UpCase(P^);
  422. if Token in ['"', ''''] then begin
  423. P := P + 1;
  424. while (P < FormatEnd) and (P^ <> Token) do
  425. P := P + 1;
  426. end
  427. else if Token = 'A' then begin
  428. if (StrLIComp(P, 'A/P', 3) = 0) or
  429. (StrLIComp(P, 'AMPM', 4) = 0) or
  430. (StrLIComp(P, 'AM/PM', 5) = 0) then begin
  431. Clock12 := true;
  432. break;
  433. end ;
  434. end ;
  435. P := P + 1;
  436. end ;
  437. while FormatCurrent < FormatEnd do begin
  438. Token := UpCase(FormatCurrent^);
  439. Count := 1;
  440. P := FormatCurrent + 1;
  441. case Token of
  442. '''', '"': begin
  443. while (P < FormatEnd) and (p^ <> Token) do
  444. P := P + 1;
  445. P := P + 1;
  446. Count := P - FormatCurrent;
  447. StoreStr(FormatCurrent + 1, Count - 2);
  448. end ;
  449. 'A': begin
  450. if StrLIComp(FormatCurrent, 'AMPM', 4) = 0 then begin
  451. Count := 4;
  452. if Hour < 12 then StoreString(TimeAMString)
  453. else StoreString(TimePMString);
  454. end
  455. else if StrLIComp(FormatCurrent, 'AM/PM', 5) = 0 then begin
  456. Count := 5;
  457. if Hour < 12 then StoreStr('am', 2)
  458. else StoreStr('pm', 2);
  459. end
  460. else if StrLIComp(FormatCurrent, 'A/P', 3) = 0 then begin
  461. Count := 3;
  462. if Hour < 12 then StoreStr('a', 1)
  463. else StoreStr('p', 1);
  464. end
  465. else
  466. Raise EConvertError.Create('Illegal character in format string');
  467. end ;
  468. '/': StoreStr(@DateSeparator, 1);
  469. ':': StoreStr(@TimeSeparator, 1);
  470. ' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y': begin
  471. while (P < FormatEnd) and (UpCase(P^) = Token) do
  472. P := P + 1;
  473. Count := P - FormatCurrent;
  474. case Token of
  475. ' ': StoreStr(FormatCurrent, Count);
  476. 'Y': begin
  477. case Count of
  478. 1: StoreInt(Year, 0);
  479. 2: StoreInt(Year mod 100, 2);
  480. 4: StoreInt(Year, 4);
  481. end ;
  482. end ;
  483. 'M': begin
  484. case Count of
  485. 1: StoreInt(Month, 0);
  486. 2: StoreInt(Month, 2);
  487. 3: StoreString(ShortMonthNames[Month]);
  488. 4: StoreString(LongMonthNames[Month]);
  489. end ;
  490. end ;
  491. 'D': begin
  492. case Count of
  493. 1: StoreInt(Day, 0);
  494. 2: StoreInt(Day, 2);
  495. 3: StoreString(ShortDayNames[DayOfWeek]);
  496. 4: StoreString(LongDayNames[DayOfWeek]);
  497. 5: StoreFormat(ShortDateFormat);
  498. 6: StoreFormat(LongDateFormat);
  499. end ;
  500. end ;
  501. 'H': begin
  502. if Clock12 then begin
  503. if Count = 1 then StoreInt(Hour mod 12, 0)
  504. else StoreInt(Hour mod 12, 2);
  505. end
  506. else begin
  507. if Count = 1 then StoreInt(Hour, 0)
  508. else StoreInt(Hour, 2);
  509. end ;
  510. end ;
  511. 'N': begin
  512. if Count = 1 then StoreInt(Minute, 0)
  513. else StoreInt(Minute, 2);
  514. end ;
  515. 'S': begin
  516. if Count = 1 then StoreInt(Second, 0)
  517. else StoreInt(Second, 2);
  518. end ;
  519. 'T': begin
  520. if Count = 1 then StoreFormat(timereformat(ShortTimeFormat))
  521. else StoreFormat(TimeReformat(LongTimeFormat));
  522. end ;
  523. 'C': StoreFormat(ShortDateFormat + ' ' + TimeReformat(ShortTimeFormat));
  524. end ;
  525. end ;
  526. else
  527. Raise EConvertError.Create('Illegal character in format string');
  528. end ;
  529. FormatCurrent := FormatCurrent + Count;
  530. end ;
  531. end ;
  532. begin
  533. DecodeDate(DateTime, Year, Month, Day);
  534. DecodeTime(DateTime, Hour, Minute, Second, MilliSecond);
  535. DayOfWeek := SysUtils.DayOfWeek(DateTime);
  536. ResultLen := 0;
  537. ResultCurrent := @ResultBuffer;
  538. StoreFormat(FormatStr);
  539. ResultBuffer[ResultLen] := #0;
  540. result := StrPas(@ResultBuffer);
  541. end ;
  542. { DateTimeToString formats DateTime to the given format in FormatStr }
  543. procedure DateTimeToString(var Result: string; const FormatStr: string; const DateTime: TDateTime);
  544. begin
  545. Result := FormatDateTime(FormatStr, DateTime);
  546. end ;
  547. Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
  548. Var YY,MM,DD,H,m,s,msec : Word;
  549. begin
  550. Decodedate (DateTime,YY,MM,DD);
  551. If (YY<1980) or (YY>2099) then
  552. Result:=0
  553. else
  554. begin
  555. DecodeTime (DateTime,h,m,s,msec);
  556. Result:=(s shr 1) or (m shl 5) or (h shl 11);
  557. Result:=Result or DD shl 16 or (MM shl 21) or ((YY-1980) shl 25);
  558. end;
  559. end;
  560. Function FileDateToDateTime (Filedate : Longint) : TDateTime;
  561. Var Date,Time : Word;
  562. begin
  563. Date:=FileDate shl 16;
  564. Time:=FileDate and $ffff;
  565. Result:=EncodeDate((Date shr 9) + 1980,(Date shr 5) and 15, Date and 31) +
  566. EncodeTime(Time shr 11, (Time shr 5) and 63, (Time and 31) shl 1,0);
  567. end;
  568. {
  569. $Log$
  570. Revision 1.13.2.1 1999-07-14 15:44:48 peter
  571. * merged
  572. Revision 1.14 1999/07/14 08:47:54 michael
  573. * faster En/Decodedate routines from Frank Reichert
  574. * Fixed FormatDateTime with short/longtimeformat.
  575. Revision 1.13 1999/05/31 20:50:44 peter
  576. * removed warnings
  577. Revision 1.12 1999/05/13 21:51:41 michael
  578. * several fixes
  579. Revision 1.11 1999/05/11 09:05:13 michael
  580. * SMall fixes to date/time routines
  581. Revision 1.10 1999/04/18 19:03:03 michael
  582. + Now EConvertError is used everywhere in conversions
  583. Revision 1.9 1999/04/08 11:31:02 peter
  584. * removed warnings
  585. Revision 1.8 1999/02/24 15:56:28 michael
  586. + Small fixes. Moved getlocaltime to system-dependent files
  587. Revision 1.7 1999/02/10 22:15:10 michael
  588. + Changed to ansistrings
  589. Revision 1.6 1999/02/09 12:38:42 michael
  590. * Fixed INt() proble. Defined THandle, included Filemode constants
  591. Revision 1.5 1998/10/15 09:39:12 michael
  592. Changes from Gretjan Schouten
  593. Revision 1.4 1998/10/11 13:40:52 michael
  594. + Added Conversion TDateTime <-> file date and time
  595. Revision 1.3 1998/09/16 08:28:36 michael
  596. Update from gertjan Schouten, plus small fix for linux
  597. Revision 1.1 1998/04/10 15:17:46 michael
  598. + Initial implementation; Donated by Gertjan Schouten
  599. His file was split into several files, to keep it a little bit structured.
  600. 1998/08/25 Gertjan
  601. + uses Go32 instead of Dos unit
  602. GetLocalTime
  603. DayOfWeek
  604. DoDecodeDate
  605. DoEncodeDate
  606. FormatDateTime
  607. }