⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _stdate.pas

📁 条码控件: 一维条码控件 二维条码控件 PDF417Barcode MaxiCodeBarcode
💻 PAS
📖 第 1 页 / 共 2 页
字号:
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDate.DecTime(StDate.DateTimeToStTime(T),
                                                   Hours,
                                                   Minutes,
                                                   Seconds));
end;

function TStDate.DMYtoStDate(Day, Month, Year, Epoch: Integer): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StDateToDateTime(StDate.DMYtoStDate(Day, Month, Year, Epoch));
end;

function TStDate.DMYtoDateString(const Picture: WideString; Day, Month,
  Year, Epoch: Integer; Pack: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.DMYtoDateString(Picture, Day, Month, Year, Epoch, Pack);
end;

function TStDate.HMStoStTime(Hours, Minutes, Seconds: Byte): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDate.HMStoStTime(Hours, Minutes, Seconds));
end;

function TStDate.IncDate(Julian: TDateTime; Days, Months,
  Years: Integer): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StDateToDateTime(StDate.IncDate(StDate.DateTimeToStDate(Julian),
                                                   Days,
                                                   Months,
                                                   Years));
end;

procedure TStDate.IncDateTime(DT1: TDateTime; var DT2: TDateTime; Days,
  Seconds: Integer);
var
  DTR1, DTR2 : StDate.TStDateTimeRec;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  DTR1.D := StDate.DateTimeToStDate(DT1);
  DTR1.T := StDate.DateTimeToStTime(DT1);

  StDate.IncDateTime(DTR1, DTR2, Days, Seconds);

  {!! This is not right }
  DT2 := DTR2.D + DTR2.T;
end;

function TStDate.IncDateTrunc(Julian: TDateTime; Months,
  Years: Integer): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StDateToDateTime(StDate.IncDateTrunc(StDate.DateTimeToStDate(Julian),
                                                        Months,
                                                        Years));
end;

function TStDate.IncTime(T: TDateTime; Hours, Minutes,
  Seconds: Byte): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDate.IncTime(StDate.DateTimeToStTime(T),
                                                   Hours,
                                                   Minutes,
                                                   Seconds));
end;

function TStDate.InternationalDate(ForceCentury: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.InternationalDate(ForceCentury);
end;

function TStDate.InternationalLongDate(ShortNames,
  ExcludeDOW: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.InternationalLongDate(ShortNames, ExcludeDOW);
end;

function TStDate.InternationalTime(ShowSeconds: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.InternationalTime(ShowSeconds);
end;

function TStDate.IsLeapYear(Year: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.IsLeapYear(Year);
end;

function TStDate.MonthToString(Month: Integer): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.MonthToString(Month);
end;

function TStDate.RoundToNearestHour(T: TDateTime;
  Truncate: WordBool): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDate.RoundToNearestHour(StDate.DateTimeToStTime(T),
                                                              Truncate));
end;

function TStDate.RoundToNearestMinute(T: TDateTime;
  Truncate: WordBool): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDate.RoundToNearestMinute(StDate.DateTimeToStTime(T),
                                                                Truncate));
end;

function TStDate.StDateToDateString(const Picture: WideString;
  Julian: TDateTime; Pack: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.StDateToDateString(Picture, StDate.DateTimeToStDate(Julian), Pack);
end;

procedure TStDate.StDateToDMY(Julian: TDateTime; var Day, Month,
  Year: Integer);
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  StDate.StDateToDMY(StDate.DateTimeToStDate(Julian), Day, Month, Year);
end;

function TStDate.StTimeToAmPmString(const Picture: WideString;
  T: TDateTime; Pack: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  StDateSt.StTimeToAmPmString(Picture, StDate.DateTimeToStTime(T), Pack);
end;

procedure TStDate.StTimeToHMS(T: TDateTime; var Hours, Minutes,
  Seconds: Byte);
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  StDate.StTimeToHMS(StDate.DateTimeToStTime(T), Hours, Minutes, Seconds);
end;

function TStDate.StTimeToTimeString(const Picture: WideString;
  T: TDateTime; Pack: WordBool): WideString;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.StTimeToTimeString(Picture, StDate.DateTimeToStTime(T), Pack);
end;

procedure TStDate.TimeDiff(T1, T2: TDateTime; var Hours, Minutes,
  Seconds: Byte);
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  StDate.TimeDiff(StDate.DateTimeToStTime(T1),
                  StDate.DateTimeToStTime(T2),
                  Hours,
                  Minutes,
                  Seconds);
end;

function TStDate.TimeStringToHMS(const Picture, TS: WideString; var Hours,
  Minutes, Seconds: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDateSt.TimeStringToHMS(Picture, TS, Hours, Minutes, Seconds);
end;

function TStDate.TimeStringToStTime(const Picture,
  S: WideString): TDateTime;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.StTimeToDateTime(StDateSt.TimeStringToStTime(Picture, S));
end;

function TStDate.ValidDate(Day, Month, Year, Epoch: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.ValidDate(Day, Month, Year, Epoch);
end;

function TStDate.ValidTime(Hours, Minutes, Seconds: Integer): WordBool;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.ValidTime(Hours, Minutes, Seconds);
end;

function TStDate.WeekOfYear(Julian: TDateTime): Byte;
begin
  {$IFDEF LICENSE}
   if (not FIsLicensed) or (not COMHasBeenLicensed) then
     OleError(CLASS_E_NOTLICENSED);
  {$ENDIF}
  Result := StDate.WeekOfYear(StDate.DateTimeToStDate(Julian));
end;

function TStDate.License(const Key: WideString): WordBool;
begin
  {$IFDEF LICENCE}
  Result := COMIsValidKey(Key);
  {$ELSE}
  Result := True;
  {$ENDIF}
  FIsLicensed := Result;
end;

initialization
  TAutoObjectFactory.Create(ComServer, TStDate, Class_StDate, ciMultiInstance, tmBoth);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -