起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 516|回复: 9

【搞定】日期操作:日期减整数?**

[复制链接]
发表于 2007-8-13 09:06:40 | 显示全部楼层 |阅读模式
我想用当前日期 减去 一个业务含义为‘月’的整数值,并返回一个计算后得到的日期字符串,怎么写代码?
回复

使用道具 举报

 楼主| 发表于 2007-8-13 09:10:13 | 显示全部楼层
将日期留到月份值
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-13 09:26:28 | 显示全部楼层
yyyy-mm
回复 支持 反对

使用道具 举报

发表于 2007-8-13 09:41:31 | 显示全部楼层
我印象有加减月的函数,直接用函数来做就可以了

至于保留到月份,你设置显示格式为“yyyy-mm”看看是否ok
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-13 09:50:34 | 显示全部楼层
temp:=SysUtils.Now-shiyongqixian*30; //now以天为单位,我用月*30 这么做可以?

      Result:=SysUtils.FormatDateTime('YYYY-MM-DD',temp)
回复 支持 反对

使用道具 举报

发表于 2007-8-13 10:04:30 | 显示全部楼层
IncMonth(SysUtils.Now, -1)
回复 支持 反对

使用道具 举报

发表于 2007-8-13 10:06:06 | 显示全部楼层
日期处理相关函数
NameSpace: Business.Forms
--------------------------------------------------------------------------------
jsDateUtil = class(System.Object)
public
  CenturyOffset: Byte;
  DefaultDateOrder: TDateOrder;
  NullDate: Double;
  static function CurrentYear: Word;
  static function CutTime(ADate: Double): Double;
  static procedure DateDiff(Date1: Double; Date2: Double; Days: Word; Months: Word; Years: Word);
  static function DaysBetween(Date1: Double; Date2: Double): Longint;
  static function DaysInPeriod(Date1: Double; Date2: Double): Longint;
  static function DaysPerMonth(AYear: Longint; AMonth: Longint): Longint;
  static function DefDateFormat(FourDigitYear: Boolean): string;
  static function DefDateMask(BlanksChar: Char; FourDigitYear: Boolean): string;
  static function ExtractDay(ADate: Double): Word;
  static function ExtractMonth(ADate: Double): Word;
  static function ExtractYear(ADate: Double): Word;
  static function FirstDayOfNextMonth: Double;
  static function FirstDayOfPrevMonth: Double;
  static function FormatLongDate(Value: Double): string;
  static function FormatLongDateTime(Value: Double): string;
  static function GetDateOrder(DateFormat: string): TDateOrder;
  static function IncDate(ADate: Double; Days: Longint; Months: Longint; Years: Longint): Double;
  static function IncDay(ADate: Double; Delta: Longint): Double;
  static function IncHour(ATime: Double; Delta: Longint): Double;
  static function IncMinute(ATime: Double; Delta: Longint): Double;
  static function IncMonth(ADate: Double; Delta: Longint): Double;
  static function IncMSec(ATime: Double; Delta: Longint): Double;
  static function IncSecond(ATime: Double; Delta: Longint): Double;
  static function IncTime(ATime: Double; Hours: Longint; Minutes: Longint; Seconds: Longint; MSecs: Longint): Double;
  static function IncYear(ADate: Double; Delta: Longint): Double;
  static function IsLeapYear(AYear: Longint): Boolean;
  static function LastDayOfPrevMonth: Double;
  static function MonthFromName(S: string; MaxLen: Byte): Byte;
  static function MonthsBetween(Date1: Double; Date2: Double): Double;
  static function StrToDateDef(S: string; Default: Double): Double;
  static function StrToDateFmt(DateFormat: string; S: string): Double;
  static function StrToDateFmtDef(DateFormat: string; S: string; Default: Double): Double;
  static function ValidDate(ADate: Double): Boolean;
  property FourDigitYear: Boolean;
end;
回复 支持 反对

使用道具 举报

发表于 2007-8-13 10:13:53 | 显示全部楼层
NameSpace: Business.System
--------------------------------------------------------------------------------
SysUtils = class(System.Object)
public
  DateDelta: Longint;
  DefaultFalseBoolStr: string;
  DefaultTrueBoolStr: string;
  DriveDelim: Char;
  faAnyFile: Shortint;
  faArchive: Shortint;
  faDirectory: Shortint;
  faHidden: Shortint;
  faReadOnly: Shortint;
  faSysFile: Shortint;
  faVolumeID: Shortint;
  fmOpenRead: Shortint;
  fmOpenReadWrite: Shortint;
  fmOpenWrite: Shortint;
  fmShareCompat: Shortint;
  fmShareDenyNone: Shortint;
  fmShareDenyRead: Shortint;
  fmShareDenyWrite: Shortint;
  fmShareExclusive: Shortint;
  HoursPerDay: Shortint;
  MaxCurrency: Int64;
  MaxDateTime: Double;
  MaxEraCount: Shortint;
  MinCurrency: Int64;
  MinDateTime: Double;
  MinsPerDay: Smallint;
  MonthDays: array of array of Word;
  MSecsPerDay: Longint;
  PathDelim: Char;
  PathSep: Char;
  pfBCB4Produced: Longint;
  pfDelphi4Produced: Longint;
  pfDesignOnly: Shortint;
  pfExeModule: Shortint;
  pfIgnoreDupUnits: Shortint;
  pfLibraryModule: Longword;
  pfModuleTypeMask: Longword;
  pfNeverBuild: Shortint;
  pfPackageModule: Longint;
  pfProducerMask: Longint;
  pfProducerUndefined: Longint;
  pfRunOnly: Shortint;
  pfV3Produced: Shortint;
  SecsPerDay: Longint;
  SwitchChars: .$$TD-E02C739A7B61423886C13D3B9229831D;
  ufImplicitUnit: Shortint;
  ufMainUnit: Shortint;
  ufOrgWeakUnit: Shortint;
  ufPackageUnit: Shortint;
  ufWeakPackageUnit: Shortint;
  ufWeakUnit: Shortint;
  UnixDateDelta: Smallint;
  static procedure Abort;
  static procedure AddExitProc(Proc: to do);
  static procedure AddTerminateProc(TermProc: to do);
  static function AdjustLineBreaks(S: string; Style: TTextLineBreakStyle): string;
  static function AllocMem(Size: Longword): TObject;
  static function AnsiCompareFileName(S1: string; S2: string): Longint;
  static function AnsiCompareStr(S1: string; S2: string): Longint;
  static function AnsiCompareText(S1: string; S2: string): Longint;
  static function AnsiDequotedStr(S: string; AQuote: Char): string;
  static function AnsiExtractQuotedStr(Src: string; Quote: Char): string;
  static function AnsiLastChar(S: string): string;
  static function AnsiLowerCase(S: string): string;
  static function AnsiLowerCaseFileName(S: string): string;
  static function AnsiPos(Substr: string; S: string): Longint;
  static function AnsiQuotedStr(S: string; Quote: Char): string;
  static function AnsiSameStr(S1: string; S2: string): Boolean;
  static function AnsiSameText(S1: string; S2: string): Boolean;
  static function AnsiStrComp(S1: string; S2: string): Longint;
  static function AnsiStrIComp(S1: string; S2: string): Longint;
  static function AnsiStrLastChar(P: string): string;
  static function AnsiStrLComp(S1: string; S2: string; MaxLen: Longword): Longint;
  static function AnsiStrLIComp(S1: string; S2: string; MaxLen: Longword): Longint;
  static function AnsiStrLower(Str: string): string;
  static function AnsiStrPos(Str: string; SubStr: string): string;
  static function AnsiStrRScan(Str: string; Chr: Char): string;
  static function AnsiStrScan(Str: string; Chr: Char): string;
  static function AnsiStrUpper(Str: string): string;
  static function AnsiUpperCase(S: string): string;
  static function AnsiUpperCaseFileName(S: string): string;
  static procedure Beep;
  static function BoolToStr(B: Boolean; UseBoolStrs: Boolean): string;
  static function ByteToCharIndex(S: string; Index: Longint): Longint;
  static function ByteToCharLen(S: string; MaxLen: Longint): Longint;
  static function ByteType(S: string; Index: Longint): TMbcsByteType;
  static function CallTerminateProcs: Boolean;
  static function ChangeFileExt(FileName: string; Extension: string): string;
  static function CharLength(S: string; Index: Longint): Longint;
  static function CharToByteIndex(S: string; Index: Longint): Longint;
  static function CharToByteLen(S: string; MaxLen: Longint): Longint;
  static function CheckWin32Version(AMajor: Longint; AMinor: Longint): Boolean;
  static function CompareMem(P1: TObject; P2: TObject; Length: Longint): Boolean;
  static function CompareStr(S1: string; S2: string): Longint;
  static function CompareText(S1: string; S2: string): Longint;
  static function CreateDir(Dir: string): Boolean;
  static function CreateGUID(Guid: TGUID): Longint;
  static function CurrentYear: Word;
  static function CurrToStr(Value: Int64): string;
  static function CurrToStrF(Value: Int64; Format: TFloatFormat; Digits: Longint): string;
  static function Date: Double;
  static function DateTimeToFileDate(DateTime: Double): Longint;
  static function DateTimeToStr(DateTime: Double): string;
  static procedure DateTimeToString(Result: string; Format: string; DateTime: Double);
  static procedure DateTimeToSystemTime(DateTime: Double; SystemTime: Borland.Delphi.Windows._SYSTEMTIME);
  static function DateTimeToTimeStamp(DateTime: Double): TTimeStamp;
  static function DateToStr(DateTime: Double): string;
  static function DayOfWeek(DateTime: Double): Word;
  static procedure DecodeDate(DateTime: Double; Year: Word; Month: Word; Day: Word);
  static function DecodeDateFully(DateTime: Double; Year: Word; Month: Word; Day: Word; DOW: Word): Boolean;
  static procedure DecodeTime(DateTime: Double; Hour: Word; Min: Word; Sec: Word; MSec: Word);

  static function DeleteFile(FileName: string): Boolean;
  static function DirectoryExists(Directory: string): Boolean;
  static function DiskFree(Drive: Byte): Int64;
  static function DiskSize(Drive: Byte): Int64;
  static function EncodeDate(Year: Word; Month: Word; Day: Word): Double;
  static function EncodeTime(Hour: Word; Min: Word; Sec: Word; MSec: Word): Double;

  static function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: TObject; Buffer: string; Size: Longint): Longint;
  static function ExcludeTrailingBackslash(S: string): string;
  static function ExcludeTrailingPathDelimiter(S: string): string;
  static function ExpandFileName(FileName: string): string;
  static function ExpandFileNameCase(FileName: string; MatchFound: TFilenameCaseMatch): string;
  static function ExpandUNCFileName(FileName: string): string;
  static function ExtractFileDir(FileName: string): string;
  static function ExtractFileDrive(FileName: string): string;
  static function ExtractFileExt(FileName: string): string;
  static function ExtractFileName(FileName: string): string;
  static function ExtractFilePath(FileName: string): string;
  static function ExtractRelativePath(BaseName: string; DestName: string): string;
  static function ExtractShortPathName(FileName: string): string;
  static function FileAge(FileName: string): Longint;
  static procedure FileClose(Handle: Longint);
  static function FileCreate(FileName: string; Rights: Longint): Longint; overload;
  static function FileCreate(FileName: string): Longint; overload;
  static function FileDateToDateTime(FileDate: Longint): Double;
  static function FileExists(FileName: string): Boolean;
  static function FileGetAttr(FileName: string): Longint;
  static function FileGetDate(Handle: Longint): Longint;
  static function FileIsReadOnly(FileName: string): Boolean;
  static function FileOpen(FileName: string; Mode: Longword): Longint;
  static function FileRead(Handle: Longint; Buffer: TObject; Count: Longword): Longint;
  static function FileSearch(Name: string; DirList: string): string;
  static function FileSeek(Handle: Longint; Offset: Int64; Origin: Longint): Int64; overload;
  static function FileSeek(Handle: Longint; Offset: Longint; Origin: Longint): Longint; overload;
  static function FileSetAttr(FileName: string; Attr: Longint): Longint;
  static function FileSetDate(Handle: Longint; Age: Longint): Longint; overload;
  static function FileSetDate(FileName: string; Age: Longint): Longint; overload;
  static function FileSetReadOnly(FileName: string; ReadOnly: Boolean): Boolean;
  static function FileWrite(Handle: Longint; Buffer: TObject; Count: Longword): Longint;
  static procedure FinalizePackage(Module: Longword);
  static procedure FindClose(F: TSearchRec);
  static function FindCmdLineSwitch(Switch: string): Boolean; overload;
  static function FindCmdLineSwitch(Switch: string; IgnoreCase: Boolean): Boolean; overload;
  static function FindCmdLineSwitch(Switch: string; Chars: TSysCharSet; IgnoreCase: Boolean): Boolean; overload;
  static function FindFirst(Path: string; Attr: Longint; F: TSearchRec): Longint;
  static function FindNext(F: TSearchRec): Longint;
  static function FloatToCurr(Value: Double): Int64;
  static function FloatToDateTime(Value: Double): Double;
  static procedure FloatToDecimal(Result: TFloatRec; Value: TObject; ValueType: TFloatValue; Precision: Longint; Decimals: Longint);
  static function FloatToStr(Value: Double): string;
  static function FloatToStrF(Value: Double; Format: TFloatFormat; Precision: Longint; Digits: Longint): string;
  static function FloatToText(BufferArg: string; Value: TObject; ValueType: TFloatValue; Format: TFloatFormat; Precision: Longint; Digits: Longint): Longint;
  static function FloatToTextFmt(Buf: string; Value: TObject; ValueType: TFloatValue; Format: string): Longint;
  static function FmtLoadStr(Ident: Longint; Args: array of TObject): string;
  static procedure FmtStr(Result: string; Format: string; Args: array of TObject);
  static function ForceDirectories(Dir: string): Boolean;
  static function Format(Format: string; Args: array of TObject): string;
  static function FormatBuf(Buffer: TObject; BufLen: Longword; Format: TObject; FmtLen: Longword; Args: array of TObject): Longword;
  static function FormatCurr(Format: string; Value: Int64): string;
  static function FormatDateTime(Format: string; DateTime: Double): string;
  static function FormatFloat(Format: string; Value: Double): string;
  static function GDAL: Longword;
  static function GetCurrentDir: string;
  static function GetEnvironmentVariable(Name: string): string; overload;
  static procedure GetFormatSettings;
  static function GetLocaleChar(Locale: Longint; LocaleType: Longint; Default: Char): Char;
  static function GetLocaleStr(Locale: Longint; LocaleType: Longint; Default: string): string;
  static function GetModuleName(Module: Longword): string;
  static function GetPackageDescription(ModuleName: string): string;
  static procedure GetPackageInfo(Module: Longword; Param: TObject; Flags: Longint; InfoProc: to do);
  static function GUIDToString(GUID: TGUID): string;
  static procedure IncAMonth(Year: Word; Month: Word; Day: Word; NumberOfMonths: Longint);
  static function IncludeTrailingBackslash(S: string): string;
  static function IncludeTrailingPathDelimiter(S: string): string;
  static function IncMonth(DateTime: Double; NumberOfMonths: Longint): Double;
  static procedure InitializePackage(Module: Longword);
  static function IntToHex(Value: Longint; Digits: Longint): string; overload;
  static function IntToHex(Value: Int64; Digits: Longint): string; overload;
  static function IntToStr(Value: Longint): string; overload;
  static function IntToStr(Value: Int64): string; overload;
  static function IsDelimiter(Delimiters: string; S: string; Index: Longint): Boolean;
  static function IsEqualGUID(guid1: TGUID; guid2: TGUID): Boolean;
  static function IsLeapYear(Year: Word): Boolean;
  static function IsPathDelimiter(S: string; Index: Longint): Boolean;
  static function IsValidIdent(Ident: string): Boolean;
  static function Languages: TLanguages;
  static function LastDelimiter(Delimiters: string; S: string): Longint;
  static function LoadPackage(Name: string): Longword;
  static function LoadStr(Ident: Longint): string;
  static function LowerCase(S: string): string;
  static function MSecsToTimeStamp(MSecs: Int64): TTimeStamp;
  static function NextCharIndex(S: string; Index: Longint): Longint;
  static function Now: Double;
  static procedure OutOfMemoryError;
  static function QuotedStr(S: string): string;
  static procedure RaiseLastOSError;
  static procedure RCS;
  static function RemoveDir(Dir: string): Boolean;
  static function RenameFile(OldName: string; NewName: string): Boolean;
  static procedure ReplaceDate(DateTime: Double; NewDate: Double);
  static procedure ReplaceTime(DateTime: Double; NewTime: Double);

  static procedure RPR;
  static function SafeLoadLibrary(Filename: string; ErrorMode: Longword): Longword;
  static function SameFileName(S1: string; S2: string): Boolean;
  static function SameText(S1: string; S2: string): Boolean;
  static function SetCurrentDir(Dir: string): Boolean;
  static procedure ShowException(ExceptObject: TObject; ExceptAddr: TObject);
  static procedure Sleep(milliseconds: Longword);
  static function StrAlloc(Size: Longword): string;
  static function StrBufSize(Str: string): Longword;
  static function StrByteType(Str: string; Index: Longword): TMbcsByteType;
  static function StrCat(Dest: string; Source: string): string;
  static function StrCharLength(Str: string): Longint;
  static function StrComp(Str1: string; Str2: string): Longint;
  static function StrCopy(Dest: string; Source: string): string;
  static procedure StrDispose(Str: string);
  static function StrECopy(Dest: string; Source: string): string;
  static function StrEnd(Str: string): string;
  static function StrFmt(Buffer: string; Format: string; Args: array of TObject): string;
  static function StrIComp(Str1: string; Str2: string): Longint;
  static function StringReplace(S: string; OldPattern: string; NewPattern: string; Flags: TReplaceFlags): string;
  static function StringToGUID(S: string): TGUID;
  static function StrLCat(Dest: string; Source: string; MaxLen: Longword): string;
  static function StrLComp(Str1: string; Str2: string; MaxLen: Longword): Longint;
  static function StrLCopy(Dest: string; Source: string; MaxLen: Longword): string;
  static function StrLen(Str: string): Longword;
  static function StrLFmt(Buffer: string; MaxBufLen: Longword; Format: string; Args: array of TObject): string;
  static function StrLIComp(Str1: string; Str2: string; MaxLen: Longword): Longint;
  static function StrLower(Str: string): string;
  static function StrMove(Dest: string; Source: string; Count: Longword): string;
  static function StrNew(Str: string): string;
  static function StrNextChar(Str: string): string;
  static function StrPas(Str: string): string;
  static function StrPCopy(Dest: string; Source: string): string;
  static function StrPLCopy(Dest: string; Source: string; MaxLen: Longword): string;
  static function StrPos(Str1: string; Str2: string): string;
  static function StrRScan(Str: string; Chr: Char): string;
  static function StrScan(Str: string; Chr: Char): string;
  static function StrToBool(S: string): Boolean;
  static function StrToBoolDef(S: string; Default: Boolean): Boolean;
  static function StrToCurr(S: string): Int64;
  static function StrToCurrDef(S: string; Default: Int64): Int64;
  static function StrToDate(S: string): Double;
  static function StrToDateDef(S: string; Default: Double): Double;
  static function StrToDateTime(S: string): Double;
  static function StrToDateTimeDef(S: string; Default: Double): Double;

  static function StrToFloat(S: string): Double;
  static function StrToFloatDef(S: string; Default: Double): Double;
  static function StrToInt(S: string): Longint;
  static function StrToInt64(S: string): Int64;
  static function StrToInt64Def(S: string; Default: Int64): Int64;
  static function StrToIntDef(S: string; Default: Longint): Longint;
  static function StrToTime(S: string): Double;
  static function StrToTimeDef(S: string; Default: Double): Double;

  static function StrUpper(Str: string): string;
  static function Supports(Instance: TObject; IID: TGUID; Intf: TObject): Boolean; overload;
  static function Supports(Instance: TObject; IID: TGUID): Boolean; overload;
  static function Supports(Instance: TObject; IID: TGUID): Boolean; overload;
  static function Supports(AClass: TClass; IID: TGUID): Boolean; overload;
  static function Supports(Instance: TObject; IID: TGUID; Intf: TObject): Boolean; overload;
  static function SysErrorMessage(ErrorCode: Longint): string;
  static function SystemTimeToDateTime(SystemTime: Borland.Delphi.Windows._SYSTEMTIME): Double;
  static function TextToFloat(Buffer: string; Value: TObject; ValueType: TFloatValue): Boolean;
  static function Time: Double;
  static function TimeStampToDateTime(TimeStamp: TTimeStamp): Double;
  static function TimeStampToMSecs(TimeStamp: TTimeStamp): Int64;
  static function TimeToStr(DateTime: Double): string;

  static function Trim(S: string): string; overload;
  static function TrimLeft(S: string): string; overload;
  static function TrimRight(S: string): string; overload;
  static function TryEncodeDate(Year: Word; Month: Word; Day: Word; Date: Double): Boolean;
  static function TryEncodeTime(Hour: Word; Min: Word; Sec: Word; MSec: Word; Time: Double): Boolean;

  static function TryFloatToCurr(Value: Double; AResult: Int64): Boolean;
  static function TryFloatToDateTime(Value: Double; AResult: Double): Boolean;
  static function TryStrToBool(S: string; Value: Boolean): Boolean;
  static function TryStrToCurr(S: string; Value: Int64): Boolean;
  static function TryStrToDate(S: string; Value: Double): Boolean;
  static function TryStrToDateTime(S: string; Value: Double): Boolean;

  static function TryStrToFloat(S: string; Value: Real): Boolean; overload;
  static function TryStrToFloat(S: string; Value: Double): Boolean; overload;
  static function TryStrToInt(S: string; Value: Longint): Boolean;
  static function TryStrToInt64(S: string; Value: Int64): Boolean;
  static function TryStrToTime(S: string; Value: Double): Boolean;
  static procedure UnloadPackage(Module: Longword);
  static function UpperCase(S: string): string;
  static function WideCompareStr(S1: string; S2: string): Longint;
  static function WideCompareText(S1: string; S2: string): Longint;
  static procedure WideFmtStr(Result: string; Format: string; Args: array of TObject);
  static function WideFormat(Format: string; Args: array of TObject): string;
  static function WideFormatBuf(Buffer: TObject; BufLen: Longword; Format: TObject; FmtLen: Longword; Args: array of TObject): Longword;
  static function WideLowerCase(S: string): string;
  static function WideSameStr(S1: string; S2: string): Boolean;
  static function WideSameText(S1: string; S2: string): Boolean;
  static function WideUpperCase(S: string): string;
  static function Win32Check(RetVal: Boolean): Boolean;
  static function WrapText(Line: string; MaxCol: Longint): string; overload;
  static function WrapText(Line: string; BreakStr: string; BreakChars: TSysCharSet; MaxCol: Longint): string; overload;
  property CurrencyDecimals: Byte;
  property CurrencyFormat: Byte;
  property CurrencyString: string;
  property DateSeparator: Char;
  property DecimalSeparator: Char;
  property EmptyStr: string;
  property EmptyWideStr: string;
  property GetDiskFreeSpaceEx: to do;
  property HexDisplayPrefix: string;
  property ListSeparator: Char;
  property LongDateFormat: string;
  property LongTimeFormat: string;

  property NegCurrFormat: Byte;
  property NullStr: string^ ;
  property NullWideStr: string^ ;
  property ShortDateFormat: string;
  property ShortTimeFormat: string;

  property SysLocale: TSysLocale;
  property ThousandSeparator: Char;
  property TimeAMString: string;
  property TimePMString: string;
  property TimeSeparator: Char;
  property TwoDigitYearCenturyWindow: Word;

  property Win32BuildNumber: Longint;
  property Win32CSDVersion: string;
  property Win32MajorVersion: Longint;
  property Win32MinorVersion: Longint;
  property Win32Platform: Longint;
end;
回复 支持 反对

使用道具 举报

发表于 2007-8-13 10:14:26 | 显示全部楼层
NameSpace: Business.System
--------------------------------------------------------------------------------
DateUtils = class(System.Object)
public
  DayFriday: Shortint;
  DayMonday: Shortint;
  DaySaturday: Shortint;
  DaysPerWeek: Shortint;
  DaysPerYear: array of Word;
  DaySunday: Shortint;
  DayThursday: Shortint;
  DayTuesday: Shortint;
  DayWednesday: Shortint;
  MonthsPerYear: Shortint;
  OneHour: Double;
  OneMillisecond: Double;
  OneMinute: Double;
  OneSecond: Double;
  RecodeLeaveFieldAsIs: Word;
  WeeksPerFortnight: Shortint;
  YearsPerCentury: Shortint;
  YearsPerDecade: Shortint;
  YearsPerMillennium: Smallint;
  static function CompareDate(A: Double; B: Double): Shortint;
  static function CompareDateTime(A: Double; B: Double): Shortint;
  static function CompareTime(A: Double; B: Double): Shortint;
  static function DateOf(AValue: Double): Double;
  static function DateTimeToJulianDate(AValue: Double): Double;
  static function DateTimeToModifiedJulianDate(AValue: Double): Double;
  static function DateTimeToUnix(AValue: Double): Int64;
  static function DayOf(AValue: Double): Word;
  static function DayOfTheMonth(AValue: Double): Word;
  static function DayOfTheWeek(AValue: Double): Word;
  static function DayOfTheYear(AValue: Double): Word;
  static function DaysBetween(ANow: Double; AThen: Double): Longint;
  static function DaysInAMonth(AYear: Word; AMonth: Word): Word;
  static function DaysInAYear(AYear: Word): Word;
  static function DaysInMonth(AValue: Double): Word;
  static function DaysInYear(AValue: Double): Word;
  static function DaySpan(ANow: Double; AThen: Double): Double;
  static procedure DecodeDateDay(AValue: Double; AYear: Word; ADayOfYear: Word);
  static procedure DecodeDateMonthWeek(AValue: Double; AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word);
  static procedure DecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word);
  static procedure DecodeDateWeek(AValue: Double; AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word);
  static procedure DecodeDayOfWeekInMonth(AValue: Double; AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word);
  static function EncodeDateDay(AYear: Word; ADayOfYear: Word): Double;
  static function EncodeDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word): Double;
  static function EncodeDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function EncodeDateWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function EncodeDayOfWeekInMonth(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word): Double;
  static function EndOfADay(AYear: Word; ADayOfYear: Word): Double; overload;
  static function EndOfADay(AYear: Word; AMonth: Word; ADay: Word): Double; overload;
  static function EndOfAMonth(AYear: Word; AMonth: Word): Double;
  static function EndOfAWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function EndOfAYear(AYear: Word): Double;
  static function EndOfTheDay(AValue: Double): Double;
  static function EndOfTheMonth(AValue: Double): Double;
  static function EndOfTheWeek(AValue: Double): Double;
  static function EndOfTheYear(AValue: Double): Double;
  static function HourOf(AValue: Double): Word;
  static function HourOfTheDay(AValue: Double): Word;
  static function HourOfTheMonth(AValue: Double): Word;
  static function HourOfTheWeek(AValue: Double): Word;
  static function HourOfTheYear(AValue: Double): Word;
  static function HoursBetween(ANow: Double; AThen: Double): Int64;
  static function HourSpan(ANow: Double; AThen: Double): Double;
  static function IncDay(AValue: Double; ANumberOfDays: Longint): Double;
  static function IncHour(AValue: Double; ANumberOfHours: Int64): Double;
  static function IncMilliSecond(AValue: Double; ANumberOfMilliSeconds: Int64): Double;
  static function IncMinute(AValue: Double; ANumberOfMinutes: Int64): Double;
  static function IncSecond(AValue: Double; ANumberOfSeconds: Int64): Double;
  static function IncWeek(AValue: Double; ANumberOfWeeks: Longint): Double;
  static function IncYear(AValue: Double; ANumberOfYears: Longint): Double;
  static procedure InvalidDateDayError(AYear: Word; ADayOfYear: Word);
  static procedure InvalidDateMonthWeekError(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word);
  static procedure InvalidDateTimeError(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; ABaseDate: Double);
  static procedure InvalidDateWeekError(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word);
  static procedure InvalidDayOfWeekInMonthError(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word);
  static function IsInLeapYear(AValue: Double): Boolean;
  static function IsPM(AValue: Double): Boolean;
  static function IsSameDay(AValue: Double; ABasis: Double): Boolean;
  static function IsToday(AValue: Double): Boolean;
  static function IsValidDate(AYear: Word; AMonth: Word; ADay: Word): Boolean;
  static function IsValidDateDay(AYear: Word; ADayOfYear: Word): Boolean;
  static function IsValidDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word): Boolean;
  static function IsValidDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Boolean;
  static function IsValidDateWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Boolean;
  static function IsValidTime(AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Boolean;
  static function JulianDateToDateTime(AValue: Double): Double;
  static function MilliSecondOf(AValue: Double): Word;
  static function MilliSecondOfTheDay(AValue: Double): Longword;
  static function MilliSecondOfTheHour(AValue: Double): Longword;
  static function MilliSecondOfTheMinute(AValue: Double): Longword;
  static function MilliSecondOfTheMonth(AValue: Double): Longword;
  static function MilliSecondOfTheSecond(AValue: Double): Word;
  static function MilliSecondOfTheWeek(AValue: Double): Longword;
  static function MilliSecondOfTheYear(AValue: Double): Int64;
  static function MilliSecondsBetween(ANow: Double; AThen: Double): Int64;
  static function MilliSecondSpan(ANow: Double; AThen: Double): Double;
  static function MinuteOf(AValue: Double): Word;
  static function MinuteOfTheDay(AValue: Double): Word;
  static function MinuteOfTheHour(AValue: Double): Word;
  static function MinuteOfTheMonth(AValue: Double): Word;
  static function MinuteOfTheWeek(AValue: Double): Word;
  static function MinuteOfTheYear(AValue: Double): Longword;
  static function MinutesBetween(ANow: Double; AThen: Double): Int64;
  static function MinuteSpan(ANow: Double; AThen: Double): Double;
  static function ModifiedJulianDateToDateTime(AValue: Double): Double;
  static function MonthOf(AValue: Double): Word;
  static function MonthOfTheYear(AValue: Double): Word;
  static function MonthsBetween(ANow: Double; AThen: Double): Longint;
  static function MonthSpan(ANow: Double; AThen: Double): Double;
  static function NthDayOfWeek(AValue: Double): Word;
  static function RecodeDate(AValue: Double; AYear: Word; AMonth: Word; ADay: Word): Double;
  static function RecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function RecodeDay(AValue: Double; ADay: Word): Double;
  static function RecodeHour(AValue: Double; AHour: Word): Double;
  static function RecodeMilliSecond(AValue: Double; AMilliSecond: Word): Double;
  static function RecodeMinute(AValue: Double; AMinute: Word): Double;
  static function RecodeMonth(AValue: Double; AMonth: Word): Double;
  static function RecodeSecond(AValue: Double; ASecond: Word): Double;
  static function RecodeTime(AValue: Double; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word): Double;
  static function RecodeYear(AValue: Double; AYear: Word): Double;
  static function SameDate(A: Double; B: Double): Boolean;
  static function SameDateTime(A: Double; B: Double): Boolean;
  static function SameTime(A: Double; B: Double): Boolean;
  static function SecondOf(AValue: Double): Word;
  static function SecondOfTheDay(AValue: Double): Longword;
  static function SecondOfTheHour(AValue: Double): Word;
  static function SecondOfTheMinute(AValue: Double): Word;
  static function SecondOfTheMonth(AValue: Double): Longword;
  static function SecondOfTheWeek(AValue: Double): Longword;
  static function SecondOfTheYear(AValue: Double): Longword;
  static function SecondsBetween(ANow: Double; AThen: Double): Int64;
  static function SecondSpan(ANow: Double; AThen: Double): Double;
  static function StartOfADay(AYear: Word; ADayOfYear: Word): Double; overload;
  static function StartOfADay(AYear: Word; AMonth: Word; ADay: Word): Double; overload;
  static function StartOfAMonth(AYear: Word; AMonth: Word): Double;
  static function StartOfAWeek(AYear: Word; AWeekOfYear: Word; ADayOfWeek: Word): Double;
  static function StartOfAYear(AYear: Word): Double;
  static function StartOfTheDay(AValue: Double): Double;
  static function StartOfTheMonth(AValue: Double): Double;
  static function StartOfTheWeek(AValue: Double): Double;
  static function StartOfTheYear(AValue: Double): Double;
  static function TimeOf(AValue: Double): Double;
  static function Today: Double;
  static function Tomorrow: Double;
  static function TryEncodeDateDay(AYear: Word; ADayOfYear: Word; AValue: Double): Boolean;
  static function TryEncodeDateMonthWeek(AYear: Word; AMonth: Word; AWeekOfMonth: Word; ADayOfWeek: Word; AValue: Double): Boolean;
  static function TryEncodeDateTime(AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; AValue: Double): Boolean;
  static function TryEncodeDateWeek(AYear: Word; AWeekOfYear: Word; AValue: Double; ADayOfWeek: Word): Boolean;
  static function TryEncodeDayOfWeekInMonth(AYear: Word; AMonth: Word; ANthDayOfWeek: Word; ADayOfWeek: Word; AValue: Double): Boolean;
  static function TryJulianDateToDateTime(AValue: Double; ADateTime: Double): Boolean;
  static function TryModifiedJulianDateToDateTime(AValue: Double; ADateTime: Double): Boolean;
  static function TryRecodeDateTime(AValue: Double; AYear: Word; AMonth: Word; ADay: Word; AHour: Word; AMinute: Word; ASecond: Word; AMilliSecond: Word; AResult: Double): Boolean;
  static function UnixToDateTime(AValue: Int64): Double;
  static function WeekOf(AValue: Double): Word;
  static function WeekOfTheMonth(AValue: Double; AYear: Word; AMonth: Word): Word; overload;
  static function WeekOfTheMonth(AValue: Double): Word; overload;
  static function WeekOfTheYear(AValue: Double): Word; overload;
  static function WeekOfTheYear(AValue: Double; AYear: Word): Word; overload;
  static function WeeksBetween(ANow: Double; AThen: Double): Longint;
  static function WeeksInAYear(AYear: Word): Word;
  static function WeeksInYear(AValue: Double): Word;
  static function WeekSpan(ANow: Double; AThen: Double): Double;
  static function WithinPastDays(ANow: Double; AThen: Double; ADays: Longint): Boolean;
  static function WithinPastHours(ANow: Double; AThen: Double; AHours: Int64): Boolean;
  static function WithinPastMilliSeconds(ANow: Double; AThen: Double; AMilliSeconds: Int64): Boolean;
  static function WithinPastMinutes(ANow: Double; AThen: Double; AMinutes: Int64): Boolean;
  static function WithinPastMonths(ANow: Double; AThen: Double; AMonths: Longint): Boolean;
  static function WithinPastSeconds(ANow: Double; AThen: Double; ASeconds: Int64): Boolean;
  static function WithinPastWeeks(ANow: Double; AThen: Double; AWeeks: Longint): Boolean;
  static function WithinPastYears(ANow: Double; AThen: Double; AYears: Longint): Boolean;
  static function YearOf(AValue: Double): Word;
  static function YearsBetween(ANow: Double; AThen: Double): Longint;
  static function YearSpan(ANow: Double; AThen: Double): Double;
  static function Yesterday: Double;
  property ApproxDaysPerMonth: Double;
  property ApproxDaysPerYear: Double;
end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-8-13 14:45:59 | 显示全部楼层
ok!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-1-14 00:51 , Processed in 0.037424 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表