Uses SysUtils, DateUtils;
//取得系統日期格式
procedure GetLocaleFormatSettings(LCID: Integer; var FormatSettings: TFormatSettings);
//時間
function Time: TDateTime;
//日期時間
function Now: TDateTime;
//今天
function Today: TDateTime;
//昨天
function Yesterday: TDateTime;
//明天
function Tomorrow: TDateTime;
//目前年份
function CurrentYear: Word;
//取DateTime年份
function YearOf(const AValue: TDateTime): Word;
//取DateTime月份
function MonthOf(const AValue: TDateTime): Word;
//取DateTime週數
function WeekOf(const AValue: TDateTime): Word;
//取DateTime日期
function DayOf(const AValue: TDateTime): Word;
//取DateTime小時數
function HourOf(const AValue: TDateTime): Word;
//取DateTime分鐘數
function MinuteOf(const AValue: TDateTime): Word;
//取DateTime秒數
function SecondOf(const AValue: TDateTime): Word;
//月份增減
function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
//年度增減
function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer = 1): TDateTime;
//週數增減
function IncWeek(const AValue: TDateTime; const ANumberOfWeeks: Integer = 1): TDateTime;
//日期增減
function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime;
//時數增減
function IncHour(const AValue: TDateTime; const ANumberOfHours: Int64 = 1): TDateTime;
//分鐘增減
function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64 = 1): TDateTime;
//秒數增減
function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64 = 1): TDateTime;
//是否為潤年
function IsLeapYear(Year: Word): Boolean;
//以指定的日期格式輸出字串
function FormatDateTime(const Format: string; DateTime: TDateTime): string;
function FormatDateTime(const Format: string; DateTime: TDateTime; const FormatSettings: TFormatSettings):
//AM/PM
function IsPM(const AValue: TDateTime): Boolean;
//檢查日期的正確性
function IsValidDate(const AYear, AMonth, ADay: Word): Boolean;
//年度第一天(年初)
function StartOfTheYear(const AValue: TDateTime): TDateTime;
function StartOfAYear(const AYear: Word): TDateTime;
//年度最後一天(年底)
function EndOfTheYear(const AValue: TDateTime): TDateTime;
function EndOfAYear(const AYear: Word): TDateTime;
//月份第一天(月初)
function StartOfTheMonth(const AValue: TDateTime): TDateTime;
function StartOfAMonth(const AYear, AMonth: Word): TDateTime;
//月份最後一天(月底)
function EndOfTheMonth(const AValue: TDateTime): TDateTime;
function EndOfAMonth(const AYear, AMonth: Word): TDateTime;
//週數第一天
function StartOfTheWeek(const AValue: TDateTime): TDateTime;
//週數最後一天
function EndOfTheWeek(const AValue: TDateTime): TDateTime;
//日期區間的天數
function DaysBetween(const ANow, AThen: TDateTime): Integer;
沒有留言:
張貼留言