mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 11:45:32 +02:00
* fixed compatibility problem of DateTimeToString
This commit is contained in:
parent
89d569f6f9
commit
36efa2d7b5
@ -551,7 +551,7 @@ var
|
||||
|
||||
procedure StoreFormat(const FormatStr: string);
|
||||
var
|
||||
Token: char;
|
||||
Token,lastformattoken: char;
|
||||
FormatCurrent: pchar;
|
||||
FormatEnd: pchar;
|
||||
Count: integer;
|
||||
@ -581,7 +581,9 @@ var
|
||||
end ;
|
||||
P := P + 1;
|
||||
end ;
|
||||
while FormatCurrent < FormatEnd do begin
|
||||
token:=#255;
|
||||
while FormatCurrent < FormatEnd do
|
||||
begin
|
||||
Token := UpCase(FormatCurrent^);
|
||||
Count := 1;
|
||||
P := FormatCurrent + 1;
|
||||
@ -614,20 +616,30 @@ var
|
||||
end ;
|
||||
'/': StoreStr(@DateSeparator, 1);
|
||||
':': StoreStr(@TimeSeparator, 1);
|
||||
' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y','Z' : begin
|
||||
' ', 'C', 'D', 'H', 'M', 'N', 'S', 'T', 'Y','Z' :
|
||||
begin
|
||||
while (P < FormatEnd) and (UpCase(P^) = Token) do
|
||||
P := P + 1;
|
||||
Count := P - FormatCurrent;
|
||||
case Token of
|
||||
' ': StoreStr(FormatCurrent, Count);
|
||||
'Y': begin
|
||||
case Count of
|
||||
1: StoreInt(Year, 0);
|
||||
2: StoreInt(Year mod 100, 2);
|
||||
4: StoreInt(Year, 4);
|
||||
end ;
|
||||
if Count>2 then
|
||||
StoreInt(Year, 4)
|
||||
else
|
||||
StoreInt(Year mod 100, 2);
|
||||
end;
|
||||
'M': begin
|
||||
if lastformattoken='H' then
|
||||
begin
|
||||
if Count = 1 then
|
||||
StoreInt(Minute, 0)
|
||||
else
|
||||
StoreInt(Minute, 2);
|
||||
|
||||
end
|
||||
else
|
||||
begin
|
||||
case Count of
|
||||
1: StoreInt(Month, 0);
|
||||
2: StoreInt(Month, 2);
|
||||
@ -635,6 +647,7 @@ var
|
||||
4: StoreString(LongMonthNames[Month]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
'D': begin
|
||||
case Count of
|
||||
1: StoreInt(Day, 0);
|
||||
@ -683,6 +696,7 @@ var
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
lastformattoken:=token;
|
||||
end;
|
||||
else
|
||||
StoreStr(@Token, 1);
|
||||
@ -740,7 +754,10 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2005-02-14 17:13:31 peter
|
||||
Revision 1.7 2005-03-10 19:48:27 florian
|
||||
* fixed compatibility problem of DateTimeToString
|
||||
|
||||
Revision 1.6 2005/02/14 17:13:31 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user