xe7 c++builder 日期时间头文件函数大全 date

时间:2021-10-20 02:11:20

c++builde r时间日期函数大全,在头文件System.DateUtils.hpp,不过没有IncMonth,因为这个函数定义在System.SysUtils.hpp里头了,唉

date,dateTime

#include <System.DateUtils.hpp>

#include <System.SysUtils.hpp>

IncMonth

IsValidDateTime,IsValidDate,IsValidTime
TryEncodeDateTime,WithinPastMonths
DaySpan,DaysBetween,WeekSpan,WeeksBetween,MonthSpan,MonthsBetween,HourSpan
 
 namespace System
{
namespace Dateutils
{
extern const Extended OneHour /*= 4.166667E-02*/;
extern const Extended OneMinute /*= 6.944444E-04*/;
extern const Extended OneSecond /*= 1.157407E-05*/;
extern const Extended OneMillisecond /*= 1.157407E-08*/;
extern const Extended EpochAsJulianDate /*= 2.415018E+06*/;
} /* namespace Dateutils */
} /* namespace System */ namespace System
{
namespace Dateutils
{ enum DECLSPEC_DENUM TLocalTimeType : unsigned char { lttStandard, lttDaylight, lttAmbiguous, lttInvalid }; class PASCALIMPLEMENTATION TTimeZone : public TObject
{
typedef TObject inherited; private:
static TTimeZone* FLocal; private:
// __classmethod void __fastcall Create@();
// __classmethod void __fastcall Destroy@(); private:
UnicodeString __fastcall GetAbbreviationForNow(void);
UnicodeString __fastcall GetDisplayNameForNow(void);
__int64 __fastcall GetUtcOffsetInSeconds(const TDateTime ADateTime, const bool ForceDaylight);
Timespan::TTimeSpan __fastcall GetCurrentUtcOffset(void); protected:
virtual void __fastcall DoGetOffsetsAndType(const TDateTime ADateTime, /* out */ __int64 &AOffset, /* out */ __int64 &ADstSave, /* out */ TLocalTimeType &AType) = ;
virtual UnicodeString __fastcall DoGetDisplayName(const TDateTime ADateTime, const bool ForceDaylight) = ;
virtual UnicodeString __fastcall DoGetID(void) = ; public:
Timespan::TTimeSpan __fastcall GetUtcOffset(const TDateTime ADateTime, const bool ForceDaylight = false);
TDateTime __fastcall ToUniversalTime(const TDateTime ADateTime, const bool ForceDaylight = false);
TDateTime __fastcall ToLocalTime(const TDateTime ADateTime);
UnicodeString __fastcall GetDisplayName(const TDateTime ADateTime, const bool ForceDaylight = false);
UnicodeString __fastcall GetAbbreviation(const TDateTime ADateTime, const bool ForceDaylight = false);
TLocalTimeType __fastcall GetLocalTimeType(const TDateTime ADateTime);
bool __fastcall IsStandardTime(const TDateTime ADateTime, const bool ForceDaylight = false);
bool __fastcall IsInvalidTime(const TDateTime ADateTime);
bool __fastcall IsAmbiguousTime(const TDateTime ADateTime);
bool __fastcall IsDaylightTime(const TDateTime ADateTime, const bool ForceDaylight = false);
__property UnicodeString ID = {read=DoGetID};
__property UnicodeString DisplayName = {read=GetDisplayNameForNow};
__property UnicodeString Abbreviation = {read=GetAbbreviationForNow};
__property Timespan::TTimeSpan UtcOffset = {read=GetCurrentUtcOffset};
/* static */ __property TTimeZone* Local = {read=FLocal};
public:
/* TObject.Create */ inline __fastcall TTimeZone(void) : TObject() { }
/* TObject.Destroy */ inline __fastcall virtual ~TTimeZone(void) { } }; //-- var, const, procedure ---------------------------------------------------
static const Int8 DaysPerWeek = Int8(0x7);
static const Int8 WeeksPerFortnight = Int8(0x2);
static const Int8 MonthsPerYear = Int8(0xc);
static const Int8 YearsPerDecade = Int8(0xa);
static const Int8 YearsPerCentury = Int8(0x64);
static const Word YearsPerMillennium = Word(0x3e8);
static const Int8 DayMonday = Int8(0x1);
static const Int8 DayTuesday = Int8(0x2);
static const Int8 DayWednesday = Int8(0x3);
static const Int8 DayThursday = Int8(0x4);
static const Int8 DayFriday = Int8(0x5);
static const Int8 DaySaturday = Int8(0x6);
static const Int8 DaySunday = Int8(0x7);
static const Int8 MonthJanuary = Int8(0x1);
static const Int8 MonthFebruary = Int8(0x2);
static const Int8 MonthMarch = Int8(0x3);
static const Int8 MonthApril = Int8(0x4);
static const Int8 MonthMay = Int8(0x5);
static const Int8 MonthJune = Int8(0x6);
static const Int8 MonthJuly = Int8(0x7);
static const Int8 MonthAugust = Int8(0x8);
static const Int8 MonthSeptember = Int8(0x9);
static const Int8 MonthOctober = Int8(0xa);
static const Int8 MonthNovember = Int8(0xb);
static const Int8 MonthDecember = Int8(0xc);
static const __int64 EpochAsUnixDate = -0x0000000083ad2180LL;
StaticArray<Word, > DaysPerYear;
static const Word RecodeLeaveFieldAsIs = Word(0xffff);
double ApproxDaysPerMonth;
double ApproxDaysPerYear;
TDateTime __fastcall DateOf(const TDateTime AValue);
TDateTime __fastcall TimeOf(const TDateTime AValue);
bool __fastcall IsInLeapYear(const TDateTime AValue);
bool __fastcall IsPM(const TDateTime AValue);
bool __fastcall IsAM(const TDateTime AValue);
bool __fastcall IsValidDate(const Word AYear, const Word AMonth, const Word ADay);
bool __fastcall IsValidTime(const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);
bool __fastcall IsValidDateTime(const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);
bool __fastcall IsValidDateMonthWeek(const Word AYear, const Word AMonth, const Word AWeekOfMonth, const Word ADayOfWeek);
bool __fastcall IsValidDateDay(const Word AYear, const Word ADayOfYear);
bool __fastcall IsValidDateWeek(const Word AYear, const Word AWeekOfYear, const Word ADayOfWeek);
Word __fastcall DaysInYear(const TDateTime AValue);
Word __fastcall DaysInAYear(const Word AYear);
Word __fastcall DaysInMonth(const TDateTime AValue);
Word __fastcall DaysInAMonth(const Word AYear, const Word AMonth);
Word __fastcall WeeksInYear(const TDateTime AValue);
Word __fastcall WeeksInAYear(const Word AYear);
TDateTime __fastcall Today(void);
TDateTime __fastcall Yesterday(void);
TDateTime __fastcall Tomorrow(void);
bool __fastcall IsToday(const TDateTime AValue);
bool __fastcall IsSameDay(const TDateTime AValue, const TDateTime ABasis);
Word __fastcall YearOf(const TDateTime AValue);
Word __fastcall MonthOf(const TDateTime AValue);
Word __fastcall WeekOf(const TDateTime AValue);
Word __fastcall DayOf(const TDateTime AValue);
Word __fastcall HourOf(const TDateTime AValue);
Word __fastcall MinuteOf(const TDateTime AValue);
Word __fastcall SecondOf(const TDateTime AValue);
Word __fastcall MilliSecondOf(const TDateTime AValue);
TDateTime __fastcall StartOfTheYear(const TDateTime AValue);
TDateTime __fastcall EndOfTheYear(const TDateTime AValue);
TDateTime __fastcall StartOfTheMonth(const TDateTime AValue);
TDateTime __fastcall EndOfTheMonth(const TDateTime AValue);
TDateTime __fastcall StartOfTheWeek(const TDateTime AValue);
TDateTime __fastcall EndOfTheWeek(const TDateTime AValue);
TDateTime __fastcall StartOfTheDay(const TDateTime AValue);
TDateTime __fastcall EndOfTheDay(const TDateTime AValue);
TDateTime __fastcall StartOfAYear(const Word AYear);
TDateTime __fastcall EndOfAYear(const Word AYear);
TDateTime __fastcall StartOfAMonth(const Word AYear, const Word AMonth);
TDateTime __fastcall EndOfAMonth(const Word AYear, const Word AMonth);
TDateTime __fastcall StartOfAWeek(const Word AYear, const Word AWeekOfYear, const Word ADayOfWeek = (Word)(0x1));
TDateTime __fastcall EndOfAWeek(const Word AYear, const Word AWeekOfYear, const Word ADayOfWeek = (Word)(0x7));
TDateTime __fastcall StartOfADay(const Word AYear, const Word ADayOfYear)/* overload */;
TDateTime __fastcall EndOfADay(const Word AYear, const Word ADayOfYear)/* overload */;
TDateTime __fastcall StartOfADay(const Word AYear, const Word AMonth, const Word ADay)/* overload */;
TDateTime __fastcall EndOfADay(const Word AYear, const Word AMonth, const Word ADay)/* overload */;
Word __fastcall MonthOfTheYear(const TDateTime AValue);
Word __fastcall WeekOfTheYear(const TDateTime AValue)/* overload */;
Word __fastcall WeekOfTheYear(const TDateTime AValue, Word &AYear)/* overload */;
Word __fastcall DayOfTheYear(const TDateTime AValue);
Word __fastcall HourOfTheYear(const TDateTime AValue);
unsigned __fastcall MinuteOfTheYear(const TDateTime AValue);
unsigned __fastcall SecondOfTheYear(const TDateTime AValue);
__int64 __fastcall MilliSecondOfTheYear(const TDateTime AValue);
Word __fastcall WeekOfTheMonth(const TDateTime AValue)/* overload */;
Word __fastcall WeekOfTheMonth(const TDateTime AValue, Word &AYear, Word &AMonth)/* overload */;
Word __fastcall DayOfTheMonth(const TDateTime AValue);
Word __fastcall HourOfTheMonth(const TDateTime AValue);
Word __fastcall MinuteOfTheMonth(const TDateTime AValue);
unsigned __fastcall SecondOfTheMonth(const TDateTime AValue);
unsigned __fastcall MilliSecondOfTheMonth(const TDateTime AValue);
Word __fastcall DayOfTheWeek(const TDateTime AValue);
Word __fastcall HourOfTheWeek(const TDateTime AValue);
Word __fastcall MinuteOfTheWeek(const TDateTime AValue);
unsigned __fastcall SecondOfTheWeek(const TDateTime AValue);
unsigned __fastcall MilliSecondOfTheWeek(const TDateTime AValue);
Word __fastcall HourOfTheDay(const TDateTime AValue);
Word __fastcall MinuteOfTheDay(const TDateTime AValue);
unsigned __fastcall SecondOfTheDay(const TDateTime AValue);
unsigned __fastcall MilliSecondOfTheDay(const TDateTime AValue);
Word __fastcall MinuteOfTheHour(const TDateTime AValue);
Word __fastcall SecondOfTheHour(const TDateTime AValue);
unsigned __fastcall MilliSecondOfTheHour(const TDateTime AValue);
Word __fastcall SecondOfTheMinute(const TDateTime AValue);
unsigned __fastcall MilliSecondOfTheMinute(const TDateTime AValue);
Word __fastcall MilliSecondOfTheSecond(const TDateTime AValue);
bool __fastcall WithinPastYears(const TDateTime ANow, const TDateTime AThen, const int AYears);
bool __fastcall WithinPastMonths(const TDateTime ANow, const TDateTime AThen, const int AMonths);
bool __fastcall WithinPastWeeks(const TDateTime ANow, const TDateTime AThen, const int AWeeks);
bool __fastcall WithinPastDays(const TDateTime ANow, const TDateTime AThen, const int ADays);
bool __fastcall WithinPastHours(const TDateTime ANow, const TDateTime AThen, const __int64 AHours);
bool __fastcall WithinPastMinutes(const TDateTime ANow, const TDateTime AThen, const __int64 AMinutes);
bool __fastcall WithinPastSeconds(const TDateTime ANow, const TDateTime AThen, const __int64 ASeconds);
bool __fastcall WithinPastMilliSeconds(const TDateTime ANow, const TDateTime AThen, const __int64 AMilliSeconds);
Between
int __fastcall YearsBetween(const TDateTime ANow, const TDateTime AThen);
int __fastcall MonthsBetween(const TDateTime ANow, const TDateTime AThen);
int __fastcall WeeksBetween(const TDateTime ANow, const TDateTime AThen);
int __fastcall DaysBetween(const TDateTime ANow, const TDateTime AThen);
__int64 __fastcall HoursBetween(const TDateTime ANow, const TDateTime AThen);
__int64 __fastcall MinutesBetween(const TDateTime ANow, const TDateTime AThen);
__int64 __fastcall SecondsBetween(const TDateTime ANow, const TDateTime AThen);
__int64 __fastcall MilliSecondsBetween(const TDateTime ANow, const TDateTime AThen);
bool __fastcall DateTimeInRange(TDateTime ADateTime, TDateTime AStartDateTime, TDateTime AEndDateTime, bool aInclusive = true);
bool __fastcall TimeInRange(TTime ATime, TTime AStartTime, TTime AEndTime, bool AInclusive = true);
bool __fastcall DateInRange(TDate ADate, TDate AStartDate, TDate AEndDate, bool AInclusive = true);
double __fastcall YearSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall MonthSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall WeekSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall DaySpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall HourSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall MinuteSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall SecondSpan(const TDateTime ANow, const TDateTime AThen);
double __fastcall MilliSecondSpan(const TDateTime ANow, const TDateTime AThen);
TDateTime __fastcall IncYear(const TDateTime AValue, const int ANumberOfYears = 0x1);
TDateTime __fastcall IncWeek(const TDateTime AValue, const int ANumberOfWeeks = 0x1);
TDateTime __fastcall IncDay(const TDateTime AValue, const int ANumberOfDays = 0x1);
#ifndef _WIN64
TDateTime __fastcall IncHour(const TDateTime AValue, const __int64 ANumberOfHours = 1LL);
TDateTime __fastcall IncMinute(const TDateTime AValue, const __int64 ANumberOfMinutes = 1LL);
TDateTime __fastcall IncSecond(const TDateTime AValue, const __int64 ANumberOfSeconds = 1LL);
TDateTime __fastcall IncMilliSecond(const TDateTime AValue, const __int64 ANumberOfMilliSeconds = 1LL);
#else /* _WIN64 */
TDateTime __fastcall IncHour(const TDateTime AValue, const __int64 ANumberOfHours = (__int64)(1LL));
TDateTime __fastcall IncMinute(const TDateTime AValue, const __int64 ANumberOfMinutes = (__int64)(1LL));
TDateTime __fastcall IncSecond(const TDateTime AValue, const __int64 ANumberOfSeconds = (__int64)(1LL));
TDateTime __fastcall IncMilliSecond(const TDateTime AValue, const __int64 ANumberOfMilliSeconds = (__int64)(1LL));
#endif /* _WIN64 */
TDateTime __fastcall EncodeDateTime(const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);
void __fastcall DecodeDateTime(const TDateTime AValue, /* out */ Word &AYear, /* out */ Word &AMonth, /* out */ Word &ADay, /* out */ Word &AHour, /* out */ Word &AMinute, /* out */ Word &ASecond, /* out */ Word &AMilliSecond);
TDateTime __fastcall EncodeDateWeek(const Word AYear, const Word AWeekOfYear, const Word ADayOfWeek = (Word)(0x1));
void __fastcall DecodeDateWeek(const TDateTime AValue, /* out */ Word &AYear, /* out */ Word &AWeekOfYear, /* out */ Word &ADayOfWeek);
TDateTime __fastcall EncodeDateDay(const Word AYear, const Word ADayOfYear);
void __fastcall DecodeDateDay(const TDateTime AValue, /* out */ Word &AYear, /* out */ Word &ADayOfYear);
TDateTime __fastcall EncodeDateMonthWeek(const Word AYear, const Word AMonth, const Word AWeekOfMonth, const Word ADayOfWeek);
void __fastcall DecodeDateMonthWeek(const TDateTime AValue, /* out */ Word &AYear, /* out */ Word &AMonth, /* out */ Word &AWeekOfMonth, /* out */ Word &ADayOfWeek);
bool __fastcall TryEncodeDateTime(const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond, /* out */ TDateTime &AValue);
bool __fastcall TryEncodeDateWeek(const Word AYear, const Word AWeekOfYear, /* out */ TDateTime &AValue, const Word ADayOfWeek = (Word)(0x1));
bool __fastcall TryEncodeDateDay(const Word AYear, const Word ADayOfYear, /* out */ TDateTime &AValue);
bool __fastcall TryEncodeDateMonthWeek(const Word AYear, const Word AMonth, const Word AWeekOfMonth, const Word ADayOfWeek, TDateTime &AValue);
TDateTime __fastcall RecodeYear(const TDateTime AValue, const Word AYear);
TDateTime __fastcall RecodeMonth(const TDateTime AValue, const Word AMonth);
TDateTime __fastcall RecodeDay(const TDateTime AValue, const Word ADay);
TDateTime __fastcall RecodeHour(const TDateTime AValue, const Word AHour);
TDateTime __fastcall RecodeMinute(const TDateTime AValue, const Word AMinute);
TDateTime __fastcall RecodeSecond(const TDateTime AValue, const Word ASecond);
TDateTime __fastcall RecodeMilliSecond(const TDateTime AValue, const Word AMilliSecond);
TDateTime __fastcall RecodeDate(const TDateTime AValue, const Word AYear, const Word AMonth, const Word ADay);
TDateTime __fastcall RecodeTime(const TDateTime AValue, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);
TDateTime __fastcall RecodeDateTime(const TDateTime AValue, const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);
bool __fastcall TryRecodeDateTime(const TDateTime AValue, const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond, /* out */ TDateTime &AResult);
Types::TValueRelationship __fastcall CompareDateTime(const TDateTime A, const TDateTime B);
bool __fastcall SameDateTime(const TDateTime A, const TDateTime B);
Types::TValueRelationship __fastcall CompareDate(const TDateTime A, const TDateTime B);
bool __fastcall SameDate(const TDateTime A, const TDateTime B);
Types::TValueRelationship __fastcall CompareTime(const TDateTime A, const TDateTime B);
bool __fastcall SameTime(const TDateTime A, const TDateTime B);
Word __fastcall NthDayOfWeek(const TDateTime AValue);
void __fastcall DecodeDayOfWeekInMonth(const TDateTime AValue, /* out */ Word &AYear, /* out */ Word &AMonth, /* out */ Word &ANthDayOfWeek, /* out */ Word &ADayOfWeek);
TDateTime __fastcall EncodeDayOfWeekInMonth(const Word AYear, const Word AMonth, const Word ANthDayOfWeek, const Word ADayOfWeek);
bool __fastcall TryEncodeDayOfWeekInMonth(const Word AYear, const Word AMonth, const Word ANthDayOfWeek, const Word ADayOfWeek, /* out */ TDateTime &AValue);
double __fastcall DateTimeToJulianDate(const TDateTime AValue);
TDateTime __fastcall JulianDateToDateTime(const double AValue);
bool __fastcall TryJulianDateToDateTime(const double AValue, /* out */ TDateTime &ADateTime);
double __fastcall DateTimeToModifiedJulianDate(const TDateTime AValue);
TDateTime __fastcall ModifiedJulianDateToDateTime(const double AValue);
bool __fastcall TryModifiedJulianDateToDateTime(const double AValue, /* out */ TDateTime &ADateTime);
__int64 __fastcall DateTimeToUnix(const TDateTime AValue, bool AInputIsUTC = true);
TDateTime __fastcall UnixToDateTime(const __int64 AValue, bool AReturnUTC = true);
void __fastcall InvalidDateTimeError(const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond, const TDateTime ABaseDate = 0.000000E+00);
void __fastcall InvalidDateWeekError(const Word AYear, const Word AWeekOfYear, const Word ADayOfWeek);
void __fastcall InvalidDateDayError(const Word AYear, const Word ADayOfYear);
void __fastcall InvalidDateMonthWeekError(const Word AYear, const Word AMonth, const Word AWeekOfMonth, const Word ADayOfWeek);
void __fastcall InvalidDayOfWeekInMonthError(const Word AYear, const Word AMonth, const Word ANthDayOfWeek, const Word ADayOfWeek);
UnicodeString __fastcall DateToISO8601(const TDateTime ADate, bool AInputIsUTC = true);
TDateTime __fastcall ISO8601ToDate(const UnicodeString AISODate, bool AReturnUTC = true);
bool __fastcall TryISO8601ToDate(const UnicodeString AISODate, /* out */ TDateTime &Value, bool AReturnUTC = true);
} /* namespace Dateutils */
} /* namespace System */