const
strDay:string =
'010203040506070809101112131415161718192021222324252627282930' +
'313233343536373839404142434445464748495051525354555657585960' +
'6162636465666768697071727374757677787980' +
'81828384858687888990919293949596979899';
str10:string = '0123456789';
var
Year,Month,Day,HH,MM,SS,ZZZ:WORD;
P:PChar;
I,J:Integer;
SystemTime: TSystemTime;
lvBuf:array[0..22] of char;
begin
if BufSize <= 0 then
Exit;
P := @lvBuf[0];// OutBuff;
for I := 0 to BufSize - 1 do P[I] := '0';
GetLocalTime(SystemTime);
Year := SystemTime.wYear;
Month := SystemTime.wMonth;
Day := SystemTime.wDay;
HH := SystemTime.wHour;
MM := SystemTime.wMinute;
SS := SystemTime.wSecond;
ZZZ := SystemTime.wMilliseconds;
(* 2012-11-04 17:59
ZZZ := 0;
HH := 0;
MM := 0;
SS := 0;
*)
//Year
I := Year div 1000;
J := Year mod 1000;
P^ := str10[I + 1];Inc(P);
I := J div 100;
P^ := str10[I + 1];Inc(P);
I := J mod 100;
if I > 0 then
begin
P^ := strDay[(I - 1) * 2 + 1];Inc(P);
P^ := strDay[(I - 1) * 2 + 2];Inc(P);
P^ := '-';Inc(P);
end
else begin
P^ := '0';Inc(P);
P^ := '0';Inc(P);
P^ := '-';Inc(P);
end;