mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:29:21 +02:00
parent
8cb651c0a5
commit
0958ff80de
@ -165,7 +165,8 @@ begin
|
|||||||
else
|
else
|
||||||
Date:=Date-1/(msecsperday*2);
|
Date:=Date-1/(msecsperday*2);
|
||||||
if Date>MaxDateTime then
|
if Date>MaxDateTime then
|
||||||
Raise EConvertError.CreateFmt('%f is not a valid TDatetime encoding, maximum value is %f.',[Date,MaxDateTime]);
|
Date:=MaxDateTime;
|
||||||
|
// Raise EConvertError.CreateFmt('%f is not a valid TDatetime encoding, maximum value is %f.',[Date,MaxDateTime]);
|
||||||
j := pred((Trunc(System.Int(Date)) + 693900) SHL 2);
|
j := pred((Trunc(System.Int(Date)) + 693900) SHL 2);
|
||||||
ly:= j DIV 146097;
|
ly:= j DIV 146097;
|
||||||
j:= j - 146097 * cardinal(ly);
|
j:= j - 146097 * cardinal(ly);
|
||||||
@ -338,14 +339,17 @@ end;
|
|||||||
|
|
||||||
{ DateTimeToStr returns a string representation of DateTime using LongDateTimeFormat }
|
{ DateTimeToStr returns a string representation of DateTime using LongDateTimeFormat }
|
||||||
|
|
||||||
function DateTimeToStr(DateTime: TDateTime): string;
|
Const
|
||||||
|
DateTimeToStrFormat : Array[Boolean] of string = ('c','f');
|
||||||
|
|
||||||
|
function DateTimeToStr(DateTime: TDateTime; ForceTimeIfZero : Boolean = False): string;
|
||||||
begin
|
begin
|
||||||
DateTimeToString(Result, 'c', DateTime);
|
DateTimeToString(Result, DateTimeToStrFormat[ForceTimeIfZero], DateTime)
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings): string;
|
function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings; ForceTimeIfZero : Boolean = False): string;
|
||||||
begin
|
begin
|
||||||
DateTimeToString(Result, 'c', DateTime ,FormatSettings);
|
DateTimeToString(Result, DateTimeToStrFormat[ForceTimeIfZero], DateTime ,FormatSettings);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ StrToDate converts the string S to a TDateTime value
|
{ StrToDate converts the string S to a TDateTime value
|
||||||
|
@ -133,8 +133,8 @@ function DateToStr(Date: TDateTime): string;
|
|||||||
function DateToStr(Date: TDateTime; const FormatSettings: TFormatSettings): string;
|
function DateToStr(Date: TDateTime; const FormatSettings: TFormatSettings): string;
|
||||||
function TimeToStr(Time: TDateTime): string;
|
function TimeToStr(Time: TDateTime): string;
|
||||||
function TimeToStr(Time: TDateTime; const FormatSettings: TFormatSettings): string;
|
function TimeToStr(Time: TDateTime; const FormatSettings: TFormatSettings): string;
|
||||||
function DateTimeToStr(DateTime: TDateTime): string;
|
function DateTimeToStr(DateTime: TDateTime; ForceTimeIfZero : Boolean = False): string;
|
||||||
function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings): string;
|
function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings; ForceTimeIfZero : Boolean = False): string;
|
||||||
function StrToDate(const S: ShortString): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
|
function StrToDate(const S: ShortString): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function StrToDate(const S: Ansistring): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
|
function StrToDate(const S: Ansistring): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function StrToDate(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function StrToDate(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user