Show: Delphi C++
Display Preferences

Date and Time Support

From RAD Studio
Jump to: navigation, search

Go Up to API Categories Index

This topic lists all types, routines, and variables that add Date and Time support.

Contents

Date and Time Data Types

The following table lists the data types used to store date and time:

Type Description

System.TDate

System.TDate is used to represent a date.

System.TDateTime

System.TDateTime represents a date-and-time value in the Delphi language.

System.SysUtils.TTimeStamp

SysUtils.TTimeStamp represents time and date values.

System.TTime

System.TTime is used to represent a time.

System.DateUtils.TTimeZone

Provides support for time zone.

Obtaining current Date and Time

The following table lists all routines used to obtain current date and time:

Routine Description

System.SysUtils.CurrentYear

Returns the current year.

System.SysUtils.Date

Returns the current date.

System.SysUtils.DayOfWeek

Returns the day of the week for a specified date.

System.SysUtils.GetTime

Returns the current time.

System.SysUtils.Now

Returns the current date and time.

System.SysUtils.Time

Returns the current time.

System.DateUtils.Today

Returns a System.TDateTime value that represents the current date.

System.DateUtils.Tomorrow

Returns a System.TDateTime value that represents the following day.

System.DateUtils.Yesterday

Returns a System.TDateTime value that represents the preceding day.



Creating Date and Time values

The following table lists all routines used to create date and time values:

Routine Description

System.SysUtils.EncodeDate

Returns a System.TDateTime value that represents a specified year, month, and day.

System.DateUtils.EncodeDateDay

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

System.DateUtils.EncodeDateMonthWeek

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

System.DateUtils.EncodeDateTime

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

System.DateUtils.EncodeDateWeek

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

System.DateUtils.EncodeDayOfWeekInMonth

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

System.SysUtils.EncodeTime

Returns a System.TDateTime value for a specified hour, minute, second, and millisecond.

System.SysUtils.TryEncodeDate

Creates a System.TDateTime value that represents a specified year, month, and day.

System.DateUtils.TryEncodeDateDay

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

System.DateUtils.TryEncodeDateMonthWeek

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

System.DateUtils.TryEncodeDateTime

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

System.DateUtils.TryEncodeDateWeek

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

System.DateUtils.TryEncodeDayOfWeekInMonth

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

System.SysUtils.TryEncodeTime

Creates a System.TDateTime value for a specified hour, minute, second, and millisecond.

Extracting information from date and time values

The following table lists all routines used to extract specific parts out of date and time values:

Routine Description

System.DateUtils.DateOf

Strips the time portion from a System.TDateTime value.

System.DateUtils.DayOf

Returns the day of the month represented by a System.TDateTime value.

System.DateUtils.DayOfTheMonth

Returns the day of the month represented by a System.TDateTime value.

System.DateUtils.DayOfTheWeek

Returns the day of the week represented by a System.TDateTime value.

System.DateUtils.DayOfTheYear

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

System.SysUtils.DecodeDate

Returns Year, Month, and Day values for a System.TDateTime value.

System.DateUtils.DecodeDateDay

Returns the year and day of the year for a specified System.TDateTime.

System.SysUtils.DecodeDateFully

Returns Year, Month, Day, and Day-of-Week values for a System.TDateTime value.

System.DateUtils.DecodeDateMonthWeek

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

System.DateUtils.DecodeDateTime

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

System.DateUtils.DecodeDateWeek

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

System.DateUtils.DecodeDayOfWeekInMonth

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

System.SysUtils.DecodeTime

Breaks a System.TDateTime value into hours, minutes, seconds, and milliseconds.

System.DateUtils.HourOf

Returns the hour of the day represented by a System.TDateTime value.

System.DateUtils.HourOfTheDay

Returns the hour of the day represented by a System.TDateTime value.

System.DateUtils.HourOfTheMonth

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

System.DateUtils.HourOfTheWeek

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

System.DateUtils.HourOfTheYear

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

System.DateUtils.MilliSecondOf

Returns the millisecond of the second represented by a System.TDateTime value.

System.DateUtils.MilliSecondOfTheDay

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

System.DateUtils.MilliSecondOfTheHour

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

System.DateUtils.MilliSecondOfTheMinute

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

System.DateUtils.MilliSecondOfTheMonth

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

System.DateUtils.MilliSecondOfTheSecond

Returns the millisecond of the second represented by a System.TDateTime value.

System.DateUtils.MilliSecondOfTheWeek

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

System.DateUtils.MilliSecondOfTheYear

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

System.DateUtils.MinuteOf

Returns the minute of the hour represented by a System.TDateTime value.

System.DateUtils.MinuteOfTheDay

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

System.DateUtils.MinuteOfTheHour

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

System.DateUtils.MinuteOfTheMonth

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

System.DateUtils.MinuteOfTheWeek

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

System.DateUtils.MinuteOfTheYear

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

System.DateUtils.MonthOf

Returns the month of the year represented by a System.TDateTime value.

System.DateUtils.MonthOfTheYear

Returns the month of the year represented by a System.TDateTime value.

System.DateUtils.NthDayOfWeek

Returns which occurrence of its weekday a specified System.TDateTime value represents.

System.DateUtils.SecondOf

Returns the second of the minute represented by a System.TDateTime value.

System.DateUtils.SecondOfTheDay

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

System.DateUtils.SecondOfTheHour

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

System.DateUtils.SecondOfTheMinute

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

System.DateUtils.SecondOfTheMonth

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

System.DateUtils.SecondOfTheWeek

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

System.DateUtils.SecondOfTheYear

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

System.DateUtils.TimeOf

Strips the date portion from a System.TDateTime value.

System.DateUtils.WeekOf

Returns the week of the year represented by a System.TDateTime value.

System.DateUtils.WeekOfTheMonth

Returns the week of the month represented by a System.TDateTime value.

System.DateUtils.WeekOfTheYear

Returns the week of the year represented by a System.TDateTime value.

System.DateUtils.WeeksInAYear

Returns the number of weeks in a specified year.

System.DateUtils.WeeksInYear

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

System.DateUtils.YearOf

Returns the year represented by a System.TDateTime value.



Comparing and Checking Date and Time values

The following table lists all routines used to compare and check date and time values:

Routine Description

System.DateUtils.CompareDate

Indicates the relationship between the date portions of two System.TDateTime values.

System.DateUtils.CompareDateTime

Indicates the relationship between two System.TDateTime values.

System.DateUtils.CompareTime

Indicates the relationship between the time portions of two System.TDateTime values.

System.DateUtils.IsInLeapYear

Indicates whether a specified System.TDateTime value occurs in a leap year.

System.DateUtils.IsAM

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

System.DateUtils.IsPM

Indicates whether the time portion of a specified System.TDateTime value occurs after noon.

System.DateUtils.IsSameDay

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

System.DateUtils.IsToday

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

System.DateUtils.IsValidDate

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

System.DateUtils.IsValidDateDay

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

System.DateUtils.IsValidDateMonthWeek

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

System.DateUtils.IsValidDateTime

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

System.DateUtils.IsValidDateWeek

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

System.DateUtils.IsValidTime

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

System.DateUtils.SameDate

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

System.DateUtils.SameDateTime

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

System.DateUtils.SameTime

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

System.DateUtils.WithinPastDays

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

System.DateUtils.WithinPastHours

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

System.DateUtils.WithinPastMilliSeconds

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

System.DateUtils.WithinPastMinutes

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

System.DateUtils.WithinPastMonths

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

System.DateUtils.WithinPastSeconds

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

System.DateUtils.WithinPastWeeks

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

System.DateUtils.WithinPastYears

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

System.DateUtils.DateInRange

Checks whether a System.TDate value is in a given range.

System.DateUtils.DateTimeInRange

Checks whether a System.TDateTime value is in a given range.

Calculations on Date and Time values

The following table lists all routines used to perform calculations on Date and Time values:

Routine Description

System.DateUtils.DaySpan

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

System.DateUtils.DaysBetween

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

System.DateUtils.DaysInAMonth

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

System.DateUtils.DaysInAYear

Returns the number of days in a specified year.

System.DateUtils.DaysInMonth

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

System.DateUtils.DaysInYear

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

System.DateUtils.EndOfADay

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

System.DateUtils.EndOfAMonth

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

System.DateUtils.EndOfAWeek

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

System.DateUtils.EndOfAYear

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

System.DateUtils.EndOfTheDay

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

System.DateUtils.EndOfTheMonth

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

System.DateUtils.EndOfTheWeek

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

System.DateUtils.EndOfTheYear

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

System.DateUtils.HourSpan

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

System.DateUtils.HoursBetween

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

System.SysUtils.IncAMonth

Increments date data by one month.

System.DateUtils.IncDay

Returns a date shifted by a specified number of days.

System.DateUtils.IncHour

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

System.DateUtils.IncMilliSecond

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

System.DateUtils.IncMinute

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

System.SysUtils.IncMonth

Returns a date shifted by a specified number of months.

System.DateUtils.IncSecond

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

System.DateUtils.IncWeek

Returns a date shifted by a specified number of weeks.

System.DateUtils.IncYear

Returns a date shifted by a specified number of years.

System.DateUtils.MilliSecondSpan

Returns the number of milliseconds between two specified System.TDateTime values.

System.DateUtils.MilliSecondsBetween

Returns the number of milliseconds between two specified System.TDateTime values.

System.DateUtils.MinuteSpan

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

System.DateUtils.MinutesBetween

Returns the number of minutes between two specified System.TDateTime values.

System.DateUtils.MonthSpan

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

System.DateUtils.MonthsBetween

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

System.DateUtils.RecodeDate

Replaces the date portion of a specified System.TDateTime value.

System.DateUtils.RecodeDateTime

Selectively replaces parts of a specified System.TDateTime value.

System.DateUtils.RecodeDay

Replaces the day of the month for a specified System.TDateTime value.

System.DateUtils.RecodeHour

Replaces the hour of the day for a specified System.TDateTime value.

System.DateUtils.RecodeMilliSecond

Replaces the millisecond of the second for a specified System.TDateTime value.

System.DateUtils.RecodeMinute

Replaces the minute of the hour for a specified System.TDateTime value.

System.DateUtils.RecodeMonth

Replaces the month of the year for a specified System.TDateTime value.

System.DateUtils.RecodeSecond

Replaces the second of the minute for a specified System.TDateTime value.

System.DateUtils.RecodeTime

Replaces the time portion of a specified System.TDateTime value.

System.DateUtils.RecodeYear

Replaces the year for a specified System.TDateTime value.

System.DateUtils.SecondSpan

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

System.DateUtils.SecondsBetween

Returns the number of seconds between two specified System.TDateTime values.

System.DateUtils.StartOfADay

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

System.DateUtils.StartOfAMonth

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

System.DateUtils.StartOfAWeek

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

System.DateUtils.StartOfAYear

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

System.DateUtils.StartOfTheDay

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

System.DateUtils.StartOfTheMonth

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

System.DateUtils.StartOfTheWeek

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

System.DateUtils.StartOfTheYear

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

System.DateUtils.WeekSpan

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

System.DateUtils.WeeksBetween

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

System.DateUtils.YearSpan

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

System.DateUtils.YearsBetween

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

Converting Date and Time values

The following table lists all routines used to convert to or from date and time values:

Routine Description

System.SysUtils.DateTimeToFileDate

Converts a System.TDateTime value to an OS timestamp value.

System.DateUtils.DateTimeToJulianDate

Converts a System.TDateTime value into a Julian date.

System.DateUtils.DateTimeToModifiedJulianDate

Converts a System.TDateTime value into a modified Julian date.

System.SysUtils.DateTimeToStr

Converts a System.TDateTime value to a string, using the local settings for displaying date and time.

System.SysUtils.DateTimeToString

Converts a System.TDateTime value to a string, using a specified SysUtils.Format.

System.SysUtils.DateTimeToSystemTime

Converts a System.TDateTime value into the Win32 API's system time type.

System.SysUtils.DateTimeToTimeStamp

Converts a System.TDateTime value into the corresponding SysUtils.TTimeStamp value.

System.DateUtils.DateTimeToUnix

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

System.SysUtils.DateToStr

Converts a System.TDateTime value to a string.

System.DateUtils.JulianDateToDateTime

Converts a Julian date to a System.TDateTime value.

System.SysUtils.MSecsToTimeStamp

Converts a specified number of milliseconds into a SysUtils.TTimeStamp value.

System.DateUtils.ModifiedJulianDateToDateTime

Converts a modified Julian date to a System.TDateTime value.

System.SysUtils.StrToDate

Converts a string to a System.TDateTime value.

System.SysUtils.StrToDateDef

Converts a string to a System.TDateTime value, with error default.

System.SysUtils.StrToDateTime

Converts a string to a System.TDateTime value.

System.SysUtils.StrToDateTimeDef

Converts a string to a System.TDateTime value, with error default.

System.SysUtils.StrToTime

Converts a string to a System.TDateTime value.

System.SysUtils.StrToTimeDef

Converts a string to a System.TDateTime value, with error default.

System.SysUtils.SystemTimeToDateTime

Converts a system time value into a System.TDateTime value.

System.SysUtils.TimeStampToDateTime

Converts a SysUtils.TTimeStamp value into the corresponding System.TDateTime value.

System.SysUtils.TimeStampToMSecs

Converts a SysUtils.TTimeStamp value into an absolute number of milliseconds.

System.SysUtils.TimeToStr

Returns a string that represents a System.TDateTime value.

System.SysUtils.TryFloatToDateTime

Converts a floating-point value to a System.TDateTime value.

System.DateUtils.TryJulianDateToDateTime

Converts a Julian date to a System.TDateTime value.

System.DateUtils.TryModifiedJulianDateToDateTime

Converts a modified Julian date to a System.TDateTime value.

System.DateUtils.TryRecodeDateTime

Selectively replaces parts of a specified System.TDateTime value.

System.SysUtils.TryStrToDate

Converts a string to a System.TDateTime value, with a Boolean success code.

System.SysUtils.TryStrToDateTime

Converts a string to a System.TDateTime value, with a Boolean success code.

System.SysUtils.TryStrToTime

Converts a string to a System.TDateTime value, with an error default.

System.DateUtils.UnixToDateTime

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

See Also

Personal tools
In other languages