Show: Delphi C++

Display Preferences

# System.DateUtils

From RAD Studio API Documentation

Package | rtl.bpl |
---|

## Contents

## Classes

EDateTimeException | |

ELocalTimeInvalid | ELocalTimeInvalid is the exception class for invalid local times. |

TTimeZone | TTimeZone offers a set of tools for timezone support. |

## Routines

CompareDate | Indicates the relationship between the date portions of two TDateTime values. |

CompareDateTime | Indicates the relationship between two TDateTime values. |

CompareTime | Indicates the relationship between the time portions of two TDateTime values. |

DateInRange | Checks whether a TDate value is in range. |

DateOf | Strips the time portion from a TDateTime value. |

DateTimeInRange | Checks whether a TDateTime value is in range. |

DateTimeToJulianDate | Converts a TDateTime value into a Julian date. |

DateTimeToMilliseconds | |

DateTimeToModifiedJulianDate | Converts a TDateTime value into a modified Julian date. |

DateTimeToUnix | Converts a TDateTime value into a Unix/Linux-style date-and-time value. |

DateToISO8601 | Converts the `ADate` date-and-time value, specified in the TDateTime format, into a string containing a date-and-time value in the ISO 8601 format. |

DayOf | Returns the day of the month represented by a TDateTime value. |

DayOfTheMonth | Returns the day of the month represented by a TDateTime value. |

DayOfTheWeek | Returns the day of the week represented by a TDateTime value. |

DayOfTheYear | Returns the number of days between a specified TDateTime value and December 31 of the previous year. |

DaysBetween | Returns the number of whole days between two specified TDateTime values. |

DaysInAMonth | Returns the number of days in a specified month of a specified year. |

DaysInAYear | Returns the number of days in a specified year. |

DaysInMonth | Returns the number of days in the month of a specified TDateTime value. |

DaysInYear | Returns the number of days in the year of a specified TDateTime value. |

DaySpan | Returns the number of days (including fractional days) between two specified TDateTime values. |

DecodeDateDay | Returns the year and day of the year for a specified TDateTime. |

DecodeDateMonthWeek | Returns the year, month, week of the month, and day of the week for a specified TDateTime. |

DecodeDateTime | Returns Year, Month, Day, Hour, Minute, Second, and Millisecond values for a TDateTime. |

DecodeDateWeek | Returns the year, week of the year, and day of the week for a specified TDateTime value object. |

DecodeDayOfWeekInMonth | For a given TDateTime value, returns the year, month, day of the week, and the count of that day of the week in the month. |

EncodeDateDay | Returns a TDateTime that represents a specified day of the year for a specified year. |

EncodeDateMonthWeek | Returns a TDateTime that represents a specified day of a specified week in a specified month and year. |

EncodeDateTime | Returns a TDateTime that represents a specified year, month, day, hour, minute, second, and millisecond. |

EncodeDateWeek | Returns a TDateTime that represents a specified day of a specified week in a specified year. |

EncodeDayOfWeekInMonth | Returns a TDateTime that represents a specified occurrence of a day of the week within a specified month and year. |

EndOfADay | Returns a TDateTime that represents the last millisecond of a specified day. |

EndOfAMonth | Returns a TDateTime that represents the last millisecond of the last day of a specified month. |

EndOfAWeek | Returns a TDateTime object value that represents the last millisecond of a specified day of a specified week. |

EndOfAYear | Returns a TDateTime that represents the last millisecond of a specified year. |

EndOfTheDay | Returns a TDateTime that represents the last millisecond of the day identified by a specified TDateTime. |

EndOfTheMonth | Returns a TDateTime that represents the last millisecond of the last day of the month identified by a specified TDateTime. |

EndOfTheWeek | Returns a TDateTime that represents the last millisecond of the last day of the week identified by a specified TDateTime. |

EndOfTheYear | Returns a TDateTime that represents the last millisecond of the last day of the year identified by a specified TDateTime. |

HourOf | Returns the hour of the day represented by a TDateTime value. |

HourOfTheDay | Returns the hour of the day represented by a TDateTime value. |

HourOfTheMonth | Returns the number of hours between a specified TDateTime value and 12:00 A.M. of the first day of the month. |

HourOfTheWeek | Returns the number of hours between a specified TDateTime value and 12:00 A.M. of the first day of the week. |

HourOfTheYear | Returns the number of hours between a specified TDateTime value and 12:00 A.M. of the first day of the year. |

HoursBetween | Returns the number of whole hours between two specified TDateTime values. |

HourSpan | Returns the number of hours (including fractional hours) between two specified TDateTime values. |

IncDay | Returns a date shifted by a specified number of days. |

IncHour | Returns a date/time value shifted by a specified number of hours. |

IncMilliSecond | Returns a date/time value shifted by a specified number of milliseconds. |

IncMinute | Returns a date/time value shifted by a specified number of minutes. |

IncSecond | Returns a date/time value shifted by a specified number of seconds. |

IncWeek | Returns a date shifted by a specified number of weeks. |

IncYear | Returns a date shifted by a specified number of years. |

InvalidDateDayError | InvalidDateDayError is used internally. |

InvalidDateMonthWeekError | InvalidDateMonthWeekError is used internally. |

InvalidDateTimeError | InvalidDateTimeError is used internally. |

InvalidDateWeekError | InvalidDateWeekError is used internally. |

InvalidDayOfWeekInMonthError | InvalidDayOfWeekInMonthError is used internally. |

IsAM | Indicates whether the time portion of a specified TDateTime value occurs before noon. |

IsInLeapYear | Indicates whether a specified TDateTime value occurs in a leap year. |

ISO8601ToDate | Converts the `AISODate` date-and-time value, specified in the ISO 8601 format, into the date-and-time value in the TDateTime format. |

IsPM | Indicates whether the time portion of a specified TDateTime value occurs in the afternoon. |

IsSameDay | Indicates whether a specified TDateTime value occurs on a the same day as a criterion date. |

IsToday | Indicates whether a specified TDateTime value occurs on the current date. |

IsValidDate | Indicates whether a specified year, month, and day represent a valid date. |

IsValidDateDay | Indicates whether a specified year and day of the year represent a valid date. |

IsValidDateMonthWeek | Indicates whether a specified year, month, week of the month, and day of the week represent a valid date. |

IsValidDateTime | Indicates whether a specified year, month, day, hour, minute, second, and millisecond represent a valid date and time. |

IsValidDateWeek | Indicates whether a specified year, week of the year, and day of the week represent a valid date. |

IsValidTime | Indicates whether a specified hour, minute, second, and millisecond represent a valid date and time. |

JulianDateToDateTime | Converts a Julian date to a TDateTime value. |

MilliSecondOf | Returns the millisecond of the second represented by a TDateTime value. |

MilliSecondOfTheDay | Returns the number of milliseconds between a specified TDateTime value and the beginning of the same day. |

MilliSecondOfTheHour | Returns the number of milliseconds between a specified TDateTime value and the beginning of the same hour. |

MilliSecondOfTheMinute | Returns the number of milliseconds between a specified TDateTime value and the beginning of the same minute. |

MilliSecondOfTheMonth | Returns the number of milliseconds between a specified TDateTime value and the beginning of the month. |

MilliSecondOfTheSecond | Returns the millisecond of the second represented by a TDateTime value. |

MilliSecondOfTheWeek | Returns the number of milliseconds between a specified TDateTime value and 12:00:00:00 A.M. of the first day of the week. |

MilliSecondOfTheYear | Returns the number of milliseconds between a specified TDateTime value and 12:00:00:00 A.M. of the first day of the year. |

MilliSecondsBetween | Returns the number of milliseconds between two specified TDateTime values. |

MilliSecondSpan | Returns the number of milliseconds between two specified TDateTime values. |

MinuteOf | Returns the minute of the hour represented by a TDateTime value. |

MinuteOfTheDay | Returns the number of minutes between a specified TDateTime value and 12:00 A.M. of the same day. |

MinuteOfTheHour | Returns the number of minutes between a specified TDateTime value and the beginning of the same hour. |

MinuteOfTheMonth | Returns the number of minutes between a specified TDateTime value and 12:00 A.M. of the first day of the month. |

MinuteOfTheWeek | Returns the number of minutes between a specified TDateTime value and 12:00 A.M. of the first day of the week. |

MinuteOfTheYear | Returns the number of minutes between a specified TDateTime value and 12:00 A.M. of the first day of the year. |

MinutesBetween | Returns the number of minutes between two specified TDateTime values. |

MinuteSpan | Returns the number of minutes, including fractions thereof, between two specified TDateTime values. |

ModifiedJulianDateToDateTime | Converts a modified Julian date to a TDateTime value. |

MonthOf | Returns the month of the year represented by a TDateTime value. |

MonthOfTheYear | Returns the month of the year represented by a TDateTime value. |

MonthsBetween | Returns the approximate number of months between two specified TDateTime values. |

MonthSpan | Returns the approximate number of months, including fractions, between two specified TDateTime values. |

NthDayOfWeek | Returns the weekday of the specified TDateTime value. |

RecodeDate | Selectively replaces the date parts of a specified TDateTime value. |

RecodeDateTime | Selectively replaces parts of a specified TDateTime value. |

RecodeDay | Replaces the day of the month for a specified TDateTime value. |

RecodeHour | Replaces the hour of the day for a specified TDateTime value. |

RecodeMilliSecond | Replaces the millisecond of the second for a specified TDateTime value. |

RecodeMinute | Replaces the minute of the hour for a specified TDateTime value. |

RecodeMonth | Replaces the month of the year for a specified TDateTime value. |

RecodeSecond | Replaces the second of the minute for a specified TDateTime value. |

RecodeTime | Selectively replaces the time parts of a specified TDateTime value. |

RecodeYear | Replaces the year for a specified TDateTime value. |

SameDate | Indicates whether two TDateTime values represent the same year, month, and day. |

SameDateTime | Indicates whether two TDateTime values represent the same year, month, day, hour, minute, second, and millisecond. |

SameTime | Indicates whether two TDateTime values represent the same time of day, ignoring the date portion. |

SecondOf | Returns the second of the minute represented by a TDateTime value. |

SecondOfTheDay | Returns the number of seconds between a specified TDateTime value and 12:00:00 A.M. of the same day. |

SecondOfTheHour | Returns the number of seconds between a specified TDateTime value and the beginning of the same hour. |

SecondOfTheMinute | Returns the number of seconds between a specified TDateTime value and the beginning of the same minute. |

SecondOfTheMonth | Returns the number of seconds between a specified TDateTime value and 12:00:00 A.M. on the first day of the month. |

SecondOfTheWeek | Returns the number of seconds between a specified TDateTime value and 12:00:00 A.M. of the first day of the week. |

SecondOfTheYear | Returns the number of seconds between a specified TDateTime value and 12:00:00 A.M. on the first day of the year. |

SecondsBetween | Returns the number of seconds between two specified TDateTime values. |

SecondSpan | Returns the number of seconds (including fractions thereof) between two specified TDateTime values. |

StartOfADay | Returns a TDateTime that represents 12:00:00:00 A.M. on a specified day. |

StartOfAMonth | Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of a specified month. |

StartOfAWeek | Returns a TDateTime that represents the first moment on a specified day of a specified week. |

StartOfAYear | Returns a TDateTime that represents the first moment on the first day of a specified year. |

StartOfTheDay | Returns a TDateTime that represents 12:00:00:00 A.M. on the day identified by a specified TDateTime. |

StartOfTheMonth | Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the month identified by a specified TDateTime. |

StartOfTheWeek | Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the week identified by a specified TDateTime. |

StartOfTheYear | Returns a TDateTime that represents 12:00:00:00 A.M. on the first day of the year identified by a specified TDateTime. |

TimeInRange | Checks whether a TDateTime value is in range. |

TimeOf | Strips the date portion from a TDateTime value. |

TimeToMilliseconds | |

Today | Returns a TDateTime value that represents the current date. |

Tomorrow | Returns a TDateTime value that represents the following day. |

TryEncodeDateDay | Calculates the TDateTime value that represents a specified day of the year for a specified year. |

TryEncodeDateMonthWeek | Calculates the TDateTime value that represents a specified day of a specified week in a specified month and year. |

TryEncodeDateTime | Calculates the TDateTime value that represents a specified year, month, day, hour, minute, second, and millisecond. |

TryEncodeDateWeek | Calculates the TDateTime value that represents a specified day of a specified week in a specified year. |

TryEncodeDayOfWeekInMonth | Calculates a TDateTime that represents a specified occurrence of a day of the week within a specified month and year. |

TryISO8601ToDate | Tries to convert the provided date-and-time value, specified in the ISO 8601 format, into the date-and-time value in the TDateTime format. Returns `True` if the conversion succeeds. |

TryJulianDateToDateTime | Converts a Julian date to a TDateTime value. |

TryModifiedJulianDateToDateTime | Converts a modified Julian date to a TDateTime value. |

TryRecodeDateTime | Selectively replaces parts of a specified TDateTime value. |

UnixToDateTime | Converts a Unix/Linux style date-and-time value to a TDateTime value. |

WeekOf | Returns the week of the year represented by a TDateTime value. |

WeekOfTheMonth | Returns the week of the month represented by a TDateTime value. |

WeekOfTheYear | Returns the week of the year represented by a TDateTime value. |

WeeksBetween | Returns the number of whole weeks between two specified TDateTime values. |

WeeksInAYear | Returns the number of weeks in a specified year. |

WeeksInYear | Returns the number of weeks in the year of a specified TDateTime value. |

WeekSpan | Returns the number of weeks (including fractional weeks) between two specified TDateTime values. |

WithinPastDays | Indicates whether two dates are within a specified number of days of each other. |

WithinPastHours | Indicates whether two date/time values are within a specified number of hours of each other. |

WithinPastMilliSeconds | Indicates whether two date/time values are within a specified number of milliseconds of each other. |

WithinPastMinutes | Indicates whether two date/time values are within a specified number of minutes of each other. |

WithinPastMonths | Indicates whether two date/time values are within a specified number of months of each other. |

WithinPastSeconds | Indicates whether two date/time values are within a specified number of seconds of each other. |

WithinPastWeeks | Indicates whether two date/time values are within a specified number of weeks of each other. |

WithinPastYears | Indicates whether two date/time values are within a specified number of years of each other. |

YearOf | Returns the year represented by a TDateTime value. |

YearsBetween | Returns the approximate number of years between two specified TDateTime values. |

YearSpan | Returns the approximate number of years (including fractions thereof) between two specified TDateTime values. |

Yesterday | Returns a TDateTime value that represents the preceding day. |

## Types

TLocalTimeType | Specifies the type of a date and time value. |

## Variables

ApproxDaysPerMonth | ApproxDaysPerMonth represents the approximate number of days in a month, over a normal four-year period. |

ApproxDaysPerYear | ApproxDaysPerYear represents the approximate number of days in a year, over a normal four-year period. |

DaysPerYear | DaysPerYear represents the number of days in a year. |

EpochAsJulianDate | |

OneHour | |

OneMillisecond | |

OneMinute | |

OneSecond |

## Constants

DayFriday | DayFriday: Integer = 5; |

DayMonday | DayMonday: Integer = 1; |

DaySaturday | DaySaturday: Integer = 6; |

DaysPerWeek | DaysPerWeek: Integer = 7; |

DaySunday | DaySunday: Integer = 7; |

DayThursday | DayThursday: Integer = 4; |

DayTuesday | DayTuesday: Integer = 2; |

DayWednesday | DayWednesday: Integer = 3; |

EpochAsUnixDate | EpochAsUnixDate: Int64 = $FFFFFFFF7C52DE80; |

MonthApril | MonthApril: Integer = 4; |

MonthAugust | MonthAugust: Integer = 8; |

MonthDecember | MonthDecember: Integer = $C; |

MonthFebruary | MonthFebruary: Integer = 2; |

MonthJanuary | MonthJanuary: Integer = 1; |

MonthJuly | MonthJuly: Integer = 7; |

MonthJune | MonthJune: Integer = 6; |

MonthMarch | MonthMarch: Integer = 3; |

MonthMay | MonthMay: Integer = 5; |

MonthNovember | MonthNovember: Integer = $B; |

MonthOctober | MonthOctober: Integer = $A; |

MonthSeptember | MonthSeptember: Integer = 9; |

MonthsPerYear | MonthsPerYear: Integer = $C; |

RecodeLeaveFieldAsIs | RecodeLeaveFieldAsIs: Integer = $FFFF; |

WeeksPerFortnight | WeeksPerFortnight: Integer = 2; |

YearsPerCentury | YearsPerCentury: Integer = $64; |

YearsPerDecade | YearsPerDecade: Integer = $A; |

YearsPerMillennium | YearsPerMillennium: Integer = $3E8; |