Date/Time manipulation routines. DateUtils contains a large number of date/time manipulation routines, all based on the TDateTime type. There are routines for date/time math, for comparing dates and times, for composing dates and decomposing dates in their constituent parts. Exception support Math support Basic types Number of days in a week. Number of weeks in fortnight Number of months in a year Number of years in a decade Number of years in a century Number of years in a millenium ISO day number for Monday ISO day number for Tuesday ISO day number for Wednesday ISO day number for Thursday ISO day number for Friday ISO day number for Saturday ISO day number for Sunday One hour as a fraction of a day (suitable for TDateTime) One minute as a fraction of a day (suitable for TDateTime) One second as a fraction of a day (suitable for TDateTime) One millisecond as a fraction of a day (suitable for TDateTime) Array with number of days in a year. The boolean index indicates whether it is a leap year or not. Bitmask deciding what to do with each TDateTime field in recode routines Average number of days in a month, measured over a year. Used in . Average number of days in a year, measured over 4 years. Used in . Extract the date part from a DateTime indication.

DateOf extracts the date part from AValue and returns the result.

Since the TDateTime is actually a double with the date part encoded in the integer part, this operation corresponds to a call to Trunc.

Date part of AValue. Datetime to extract date from Extract the time part from a DateTime indication.

TimeOf extracts the time part from AValue and returns the result.

Since the TDateTime is actually a double with the time part encoded in the fractional part, this operation corresponds to a call to Frac.

Time part of AValue. Datetime to extract time from Determine whether a date is in a leap year. IsInLeapYear returns True if the year part of AValue is leap year, or False if not. True if AValue is in a leap year, False if not. Date to be checked. Determine whether a time is PM or AM. IsPM returns True if the time part of AValue is later then 12:00 (PM, or afternoon). True if the time part of AValue is PM (afternoon). Time to check. Check whether a set of values is a valid date indication.

IsValidDate returns True when the values AYear, AMonth, ADay form a valid date indication. If one of the values is not valid (e.g. the day is invalid or does not exist in that particular month), False is returned.

AYear must be in the range 1..9999 to be valid.

True if the given values form a valid date, False if not. Year value Month in the year Day in the month Check whether a set of values is a valid time indication. True if the given values form a valid time, False if not. IsValidTime returns True when the values AHour, AMinute, ASecond and AMilliSecond form a valid time indication. If one of the values is not valid (e.g. the seconds are larger than 60), False is returned. Hour of the day. Minute in the hour Second in the minute Milliseconds in the second Check whether a set of values is a valid date and time indication.

IsValidTime returns True when the values AYear, AMonth, ADay, AHour, AMinute, ASecond and AMilliSecond form a valid date and time indication. If one of the values is not valid (e.g. the seconds are larger than 60), False is returned.

AYear must be in the range 1..9999 to be valid.

True if the given values form a valid date/time pair, False if not. Year value Month in the year Day in the month Hour of the day Minute in the hour Second in the minute Milliseconds in the second Check whether a given year/day of year combination is a valid date.

IsValidDateDay returns True if AYear and ADayOfYear form a valid date indication, or False otherwise.

AYear must be in the range 1..9999 to be valid.

The ADayOfYear value is checked to see whether it falls within the valid range of dates for AYear.

True if the given combination is a valid date, False otherwise. Year Day in the year Check whether a given year/week/day of the week combination is a valid day.

IsValidDateWeek returns True if AYear, AWeekOfYear and ADayOfWeek form a valid date indication, or False otherwise.

AYear must be in the range 1..9999 to be valid.

The ADayOfWeek,ADayOfWeek values are checked to see whether the combination falls within the valid range of weeks for AYear.

True if the given combination is a valid date, False otherwise. Year Week in the year Day in the week Check whether a given year/month/week/day of the week combination is a valid day

IsValidDateMonthWeek returns True if AYear, AMonth AWeekOfMonth and ADayOfWeek form a valid date indication, or False otherwise.

AYear must be in the range 1..9999 to be valid.

The AWeekOfMonth,ADayOfWeek values are checked to see whether the combination falls within the valid range of weeks for the AYear,AMonth combination.

True if the given combination is a valid date, False otherwise. Year Month of the year Week of the month. Day in the week. return the number of weeks in the year, given a date

WeeksInYear returns the number of weeks in the year part of AValue. The return value is either 52 or 53.

The first week of the year is determined according to the ISO 8601 standard: It is the first week that has at least 4 days in it, i.e. it includes a thursday.
Number of weeks. Day in the year. Return the number of weeks in a given year

WeeksInAYear returns the number of weeks in the year AYear. The return value is either 52 or 53.

The first week of the year is determined according to the ISO 8601 standard: It is the first week that has at least 4 days in it, i.e. it includes a thursday.
Number of weeks in AYear A (valid) year. Return the number of days in the year in which a date occurs.

daysInYear returns the number of days in the year part of AValue. The return value is either 365 or 366.

Number of days in the year in which AValue occurs. Date in year of which to calculate the number of days. Number of days in a particular year.

DaysInAYear returns the number of weeks in the year AYear. The return value is either 365 or 366.

Number of days in year AYear. Year to return the number of days from Return the number of days in the month in which a date occurs.

DaysInMonth returns the number of days in the month in which AValue falls. The return value takes leap years into account.

Number of days in the month in which AValue occurs. Date in month of which to calculate the number of days. Number of days in a month of a certain year.

DaysInYMonth returns the number of days in the month AMonth in the yearAYear. The return value takes leap years into account.

The number of days in month AMonth, in year AYear. Year in which the month occurs. Month of which the number of days should be returned. Return the current date

Today is an alias for the Date function in the sysutils unit.

For an example, see

Date
Current day as TDateTime. Return the previous day. Yesterday returns yesterday's date. Yesterday is determined from the system clock, i.e. it is -1. Previous day as TDateTime. Return the next day Tomorrow returns tomorrow's date. Tomorrow is determined from the system clock, i.e. it is +1. Next day as TDateTime. Check whether a given date is today. IsToday returns True if AValue is today's date, and False otherwise. True if AValue is today, False otherwise. Date to check, may contain a time part. Check if two date/time indications are the same day. IsSameDay checks whether AValue and ABasis have the same date part, and returns True if they do, False if not. True if AValue and ABasis are on the same day, False otherwise.. First date/time Second date/time Given a day of the week, return the previous day of the week.

PreviousDayOfWeek returns the previous day of the week. If the current day is the first day of the week (1) then the last day will be returned (7).

Note that the days of the week are in ISO notation, i.e. 1-based.
The day of the week prior to DayOfWeek Day of the week. Extract the year from a given date. YearOf returns the year part of the AValue date/time indication. It is a number between 1 and 9999. Year part of AValue Date to extract year from. Extract the month from a given date.

MonthOf returns the month part of the AValue date/time indication. It is a number between 1 and 12.

For an example, see

Month part of AValue Date to extract month from. Extract week (of the year) from a given date.

WeekOf returns the week-of-the-year part of the AValue date/time indication. It is a number between 1 and 53.

For an example, see

Week part of AValue. Date to extract week from. Extract the day (of month) part from a DateTime value

DayOf returns the day of the month part of the AValue date/time indication. It is a number between 1 and 31.

For an example, see

Day of month part of AValue. Date to extract day of. Extract the hour part from a DateTime value.

HourOf returns the hour of the day part of the AValue date/time indication. It is a number between 0 and 23.

For an example, see

Hour part of AValue. Date/time value to extract hour from. Extract the minute part from a DateTime value.

MinuteOf returns the minute of the hour part of the AValue date/time indication. It is a number between 0 and 59.

For an example, see

Minute part of AValue. Date/time value to extract minute from. Extract the second part from a DateTime value.

SecondOf returns the second of the minute part of the AValue date/time indication. It is a number between 0 and 59.

For an example, see

Second part of AValue. Date/time value to extract second from. Extract the millisecond part from a DateTime value.

MillisecondOf returns the second of the minute part of the AValue date/time indication. It is a number between 0 and 999.

For an example, see

Millisecond part of AValue. Date/time value to extract millisecond from. Return the first day of the year, given a date in this year. StartOfTheYear extracts the year part of AValue and returns a TDateTime value with the date of the first day of that year (January 1), as the function. First day of the year as a TDateTime value. Date in year of which to return the start Calculate a DateTime value representing the last day of a year, given a date in that year. EndOfTheYear extracts the year part of AValue and returns a TDateTime value with the date of the last day of that year (December 31), as the function. DateTime value representing the end of the year in which AValue falls. Date in the year of which the end should be calculated Return the first day of a given year. StartOfAYear returns a TDateTime value with the date of the first day of the year AYear (January 1). First day of AYear as a TDateTime Year to get first date from. Calculate a DateTime value representing the last day of a year StartOfAYear returns a TDateTime value with the date of the last day of the year AYear (December 31). DateTime representing the last day of AYear. Year to calculate last day from Calculate the first day of the month, given a date in that month. StartOfTheMonth extracts the year and month parts of AValue and returns a TDateTime value with the date of the first day of that year and month as the function. First day of month as a TDateTime value. Date to return first of month from Calculate a DateTime value representing the last day of the month, given a day in that month. EndOfTheMonth extracts the year and month parts of AValue and returns a TDateTime value with the date of the first day of that year and month as the function. DateTime value representing the last day of the month in which AVAlue is a day. Day in the month of which the last day should be returned. Return first date of month, given a year/month pair. StartOfAMonth e returns a TDateTime value with the date of the first day of the month indicated by the AYear, AMonth pair. First day of the month AMonth in AYear A year. Month in the year. Calculate a datetime value representing the last day of the indicated month EndOfAMonth e returns a TDateTime value with the date of the last day of the month indicated by the AYear, AMonth pair. DateTime value indicating the last day of AMonth in year AYear. Year in which month occurs Month to calculate end of Return the first day of the week, given a date. StartOfTheWeek extracts the year and week parts of AValue and returns a TDateTime value with the date of the first day of that week as the function. First day of the week, in TDateTime format. Day in the week. Calculate a DateTime value which represents the end of a week, given a date in that week. EndOfTheWeek extracts the year and week parts of AValue and returns a TDateTime value with the date of the last day of that week as the function. DateTime value representing the last day of the week in which AVAlue is a day. Day in the week of which the last day should be calculated. Return a day of the week, given a year, week and day in the week.

StartOfAWeek returns a TDateTime value with the date of the indicated day of the week indicated by the AYear, AWeek, ADayOfWeek values.

The default value for ADayOfWeek is 1.

First day of the given week, in TDateTime format. Year Week in the year Day in the week (default 1) Return the last moment of day of the week, given a year and a week in the year.

EndOfAWeek returns a TDateTime value with the date of the last moment (23:59:59:999) on the indicated day of the week indicated by the AYear, AWeek, ADayOfWeek values.

The default value for ADayOfWeek is 7.

Day of the week Calculate the start of the day as a DateTime value, given a moment in the day.

StartOfTheDay extracts the date part of AValue and returns a TDateTime value with the date/time indication of the start (0:0:0.000) of this day.

Start of the day (00:00) as DateTime value DateTime from which to calculate start of the day. Calculate a datetime value that represents the end of a given day.

EndOfTheDay extracts the date part of AValue and returns a TDateTime value with the date/time indication of the last moment (23:59:59.999) of this day.

A datetime value representing the time 23:59:59.999 of the day AValue. Day to calculate the end of Return the start of a day as a DateTime value, given a day indication

StartOfADay returns a TDateTime value with the date/time indication of the start (0:0:0.000) of the day given by AYear, AMonth, ADay.

The day may also be indicated with a AYear, ADayOfYear pair.

Start of the given day as DateTime Year Month in the year Day in the month. Day in the year. Calculates a DateTime value representing the end of a specified day

EndOfADay returns a TDateTime value with the date/time indication of the last moment (23:59:59.999) of the day given by AYear, AMonth, ADay.

The day may also be indicated with a AYear, ADayOfYear pair.

A datetime value representing the time 23:59:59.999 of the given day. Year Month in the year Day in the month Day of the year Extract the month of a DateTime indication.

MonthOfTheYear extracts the month part of Avalue and returns it. It is an alias for , and is provided for completeness only, corresponding to the other PartOfTheYear functions.

For an example, see the function.

The month part of AValue Date from which to extract month Extract the week of the year (and optionally year) of a DateTime indication.

WeekOfTheYear extracts the week of the year from Avalue and returns it, and optionally returns the year as well. It returns the same value as .

Note that weeks are numbered from 1 using the ISO 8601 standard, and the day of the week as well. This means that the year may not be the same as the year part of the date, since the week may start in the previous year as the first week of the year is the week with at least 4 days in it.
Week of the year in which Avalue falls. Date from which to extract week. Year part of AValue Extracts the day of the year from a TDateTime value

DayOfTheYear returns the number of days that have passed since the start of the year till the moment indicated by AValue. This is a one-based number, i.e. January 1 will return 1.

For an example, see the function.

Day of the year from AValue. DateTime to extract the day of the year from. Calculate the number of hours passed since the start of the year.

HourOfTheYear returns the number of hours that have passed since the start of the year (January 1, 00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. January 1 00:59:59 will return 0.

For an example, see the function.

Number of hours passed since the start of the year till AValue . DateTime value for which to calculate the hour of the year Calculate the number of minutes elapsed since the start of the year

MinuteOfTheYear returns the number of minutes that have passed since the start of the year (January 1, 00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. January 1 00:00:59 will return 0.

For an example, see the function.

Number of minutes elapsed since the start of the year. Moment in the year. Calculate the number of seconds elapsed since the start of the year.

SecondOfTheYear returns the number of seconds that have passed since the start of the year (January 1, 00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. January 1 00:00:00.999 will return 0.

For an example, see the function.

Number of seconds elapsed since the start of the year. Moment in the year Calculate the number of milliseconds elapsed since the start of the year.

MilliSecondOfTheYear returns the number of milliseconds that have passed since the start of the year (January 1, 00:00:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. January 1 00:00:00.000 will return 0.

For an example, see the function.

Number of seconds elapsed since the start of the year. Moment in the year Extract the week of the month (and optionally month and year) from a DateTime value

WeekOfTheMonth extracts the week of the month from Avalue and returns it, and optionally returns the year and month as well (in AYear, AMonth respectively).

Note that weeks are numbered from 1 using the ISO 8601 standard, and the day of the week as well. This means that the year and month may not be the same as the year part of the date, since the week may start in the previous year as the first week of the year is the week with at least 4 days in it.
Week of the month Datetime value of which to calculate the week, month and year. Year part of AValue Month part of AValue Extract the day (of month) part of a DateTime value

DayOfTheMonth returns the number of days that have passed since the start of the month till the moment indicated by AValue. This is a one-based number, i.e. the first day of the month will return 1.

For an example, see the function.

Day in the month Datetime value to extract day from. Calculate the number of hours passed since the start of the month.

HourOfTheMonth returns the number of hours that have passed since the start of the month till the moment indicated by AValue. This is a zero-based number, i.e. 00:59:59 on the first day of the month will return 0.

For an example, see the function.

Number of hours passed since the start of the month till AValue. DateTime value for which to calculate the hour of the month. Calculate number of minutes elapsed since the start of the month.

MinuteOfTheMonth returns the number of minutes that have passed since the start of the Month (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:59 on the first day of the month will return 0.

For an example, see the function.

Number of minutes elapsed since the start of the month. Moment in the month. Calculate number of seconds elapsed since the start of the month.

SecondOfTheMonth returns the number of seconds that have passed since the start of the month (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.999 on the first day of the month will return 0.

For an example, see the function.

Number of seconds elapsed since the start of the month. Moment in the month. Calculate number of milliseconds elapsed since the start of the month.

MilliSecondOfTheMonth returns the number of milliseconds that have passed since the start of the month (00:00:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.000 on the first of the month will return 0.

For an example, see the function.

Number of milliseconds elapsed since the start of the month. Moment in the month Extracts the day of the week from a DateTime value

DayOfTheWeek returns the number of days that have passed since the start of the week till the moment indicated by AValue. This is a one-based number, i.e. the first day of the week will return 1.

Day of the week from AValue. DateTime to extract the day of the week from. Calculate the number of hours elapsed since the start of the week.

HourOfTheWeek returns the number of hours that have passed since the start of the Week till the moment indicated by AValue. This is a zero-based number, i.e. 00:59:59 on the first day of the week will return 0.

For an example, see the function.

Number of hours elapsed since the start of the week till AValue. DateTime value for which to calculate the hour of the week. Calculate the number of minutes elapsed since the start of the week

MinuteOfTheWeek returns the number of minutes that have passed since the start of the week (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:59 on the first day of the week will return 0.

For an example, see the function.

Number of seconds elapsed since the start of the week Moment in the week. Calculate the number of seconds elapsed since the start of the week

SecondOfTheWeek returns the number of seconds that have passed since the start of the week (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.999 on the first day of the week will return 0.

For an example, see the function.

Number of seconds elapsed since the start of the week Moment in the week Calculate the number of milliseconds elapsed since the start of the week

MilliSecondOfTheWeek returns the number of milliseconds that have passed since the start of the Week (00:00:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.000 on the first of the Week will return 0.

For an example, see the function.

Number of milliseconds passed since the start of the week. Moment in the week to calculate milliseconds from. Calculate the hour of a given DateTime value

HourOfTheDay returns the number of hours that have passed since the start of the day till the moment indicated by AValue. This is a zero-based number, i.e. 00:59:59 will return 0.

Hour part of AValue. DateTime to calculate the hour of. Calculate the number of minutes elapsed since the start of the day

MinuteOfTheDay returns the number of minutes that have passed since the start of the Day (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:59 will return 0.

For an example, see the function.

Number of minutes elapsed since the start of the day Moment in the day Calculate the number of seconds elapsed since the start of the day

SecondOfTheDay returns the number of seconds that have passed since the start of the Day (00:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.999 return 0.

For an example, see the function.

Number of seconds elapsed since the start of the day Moment in the day Calculate the number of milliseconds elapsed since the start of the day

MilliSecondOfTheDay returns the number of milliseconds that have passed since the start of the Day (00:00:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. 00:00:00.000 will return 0.

For an example, see the function.

Number of milliseconds elapsed since the start of the day Moment in the day Calculate the number of minutes elapsed since the start of the hour

MinuteOfTheHour returns the number of minutes that have passed since the start of the Hour (HH:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. HH:00:59 will return 0.

Number of minutes elapsed since the start of the hour Moment in the hour Calculate the number of seconds elapsed since the start of the hour

SecondOfTheHour returns the number of seconds that have passed since the start of the Hour (HH:00:00) till the moment indicated by AValue. This is a zero-based number, i.e. HH:00:00.999 return 0.

For an example, see the function.

Number of seconds elapsed since the start of the hour Moment in the hour Calculate the number of milliseconds elapsed since the start of the hour

MilliSecondOfTheHour returns the number of milliseconds that have passed since the start of the Hour (HH:00:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. HH:00:00.000 will return 0.

For an example, see the function.

Number of milliseconds elapsed since the start of the hour Moment in the hour Calculate the number of seconds elapsed since the start of the minute

SecondOfTheMinute returns the number of seconds that have passed since the start of the minute (HH:MM:00) till the moment indicated by AValue. This is a zero-based number, i.e. HH:MM:00.999 return 0.

Number of seconds elapsed since the start of the minute Moment in the minute Calculate the number of milliseconds elapsed since the start of the minute

MilliSecondOfTheMinute returns the number of milliseconds that have passed since the start of the Minute (HH:MM:00.000) till the moment indicated by AValue. This is a zero-based number, i.e. HH:MM:00.000 will return 0.

For an example, see the function.

Number of milliseconds elapsed since the start of the minute Moment in the minute Calculate the number of milliseconds elapsed since the start of the second

MilliSecondOfTheSecond returns the number of milliseconds that have passed since the start of the second (HH:MM:SS.000) till the moment indicated by AValue. This is a zero-based number, i.e. HH:MM:SS.000 will return 0.

Number of milliseconds elapsed since the start of the second Moment in the second Check whether two datetimes are only a number of years apart

WithinPastYears compares the timestamps ANow and AThen and returns True if the difference between them is at most AYears years apart, or False if they are further apart.

Since this function uses the function to calculate the difference in years, this means that fractional years do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half years apart, the result will also be True
True if ANow and Athen are only AYears apart, false otherwise First moment in time Second moment in time Number of years to check Check whether two datetimes are only a number of months apart

WithinPastMonths compares the timestamps ANow and AThen and returns True if the difference between them is at most AMonths months apart, or False if they are further apart.

Since this function uses the function to calculate the difference in Months, this means that fractional months do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half months apart, the result will also be True
True if ANow and Athen are only AMonths apart, false otherwise First moment in time Second moment in time Number of months to check Check whether two datetimes are only a number of weeks apart

WithinPastWeeks compares the timestamps ANow and AThen and returns True if the difference between them is at most AWeeks weeks apart, or False if they are further apart.

Since this function uses the function to calculate the difference in Weeks, this means that fractional Weeks do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half weeks apart, the result will also be True
True if ANow and Athen are only AWeeks apart, false otherwise First moment in time Second moment in time Number of weeks to check Check whether two datetimes are only a number of days apart

WithinPastDays compares the timestamps ANow and AThen and returns True if the difference between them is at most ADays days apart, or False if they are further apart.

Since this function uses the function to calculate the difference in days, this means that fractional days do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half days apart, the result will also be True
True if ANow and Athen are only ADays apart, false otherwise First moment in time Second moment in time Number of days to check Check whether two datetimes are only a number of hours apart

WithinPastHours compares the timestamps ANow and AThen and returns True if the difference between them is at most AHours hours apart, or False if they are further apart.

Since this function uses the function to calculate the difference in Hours, this means that fractional hours do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half hours apart, the result will also be True
True if ANow and Athen are only AHours apart, false otherwise First moment in time Second moment in time Number of hours to check Check whether two datetimes are only a number of minutes apart

WithinPastMinutes compares the timestamps ANow and AThen and returns True if the difference between them is at most AMinutes minutes apart, or False if they are further apart.

Since this function uses the function to calculate the difference in Minutes, this means that fractional minutes do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half minutes apart, the result will also be True
True if ANow and Athen are only AMinutes apart, false otherwise First moment in time Second moment in time Number of minutes to check Check whether two datetimes are only a number of seconds apart

WithinPastSeconds compares the timestamps ANow and AThen and returns True if the difference between them is at most ASeconds seconds apart, or False if they are further apart.

Since this function uses the function to calculate the difference in seconds, this means that fractional seconds do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half seconds apart, the result will also be True
True if ANow and Athen are only ASeconds apart, false otherwise First moment in time Second moment in time Number of seconds to check Check whether two datetimes are only a number of milliseconds apart

WithinPastMilliSeconds compares the timestamps ANow and AThen and returns True if the difference between them is at most AMilliSeconds milliseconds apart, or False if they are further apart.

Since this function uses the function to calculate the difference in milliseconds, this means that fractional milliseconds do not count, and the fractional part is simply dropped, so for two dates actually 2 and a half milliseconds apart, the result will also be True
True if ANow and Athen are only AMilliSeconds apart, false otherwise First moment in time Second moment in time Number of milliseconds to check Calculate the number of whole years between two DateTime values YearsBetween returns the number of whole years between ANow and AThen. This number is an approximation, based on an average number of days of 365.25 per year (average over 4 years). This means the fractional part of a year is dropped. Number of whole years between ANow and AThen. First moment in time Second moment in time Calculate the number of whole months between two DateTime values MonthsBetween returns the number of whole months between ANow and AThen. This number is an approximation, based on an average number of days of 30.4375 per month (average over 4 years). This means the fractional part of a month is dropped. Number of whole months between ANow and AThen. First moment in time Second moment in time Calculate the number of whole weeks between two DateTime values WeeksBetween returns the number of whole weeks between ANow and AThen. This means the fractional part of a Week is dropped. Number of whole weeks between ANow and AThen. First moment in time Second moment in time Number of whole days between two DateTime values. DaysBetween returns the number of whole days between ANow and AThen. This means the fractional part of a day (hours, minutes, etc.) is dropped. Number of whole days between ANow and AThen. First date Second date Calculate the number of whole hours between two DateTime values. HoursBetween returns the number of whole hours between ANow and AThen. This means the fractional part of an hour (minutes,seconds etc.) is dropped. Number of hours between ANow and AThen First DateTime value Second DateTime value Calculate the number of whole minutes between two DateTime values. MinutesBetween returns the number of whole minutes between ANow and AThen. This means the fractional part of a minute (seconds, milliseconds etc.) is dropped. Number of minutes between ANow and AThen First moment in time Second moment in time Calculate the number of whole seconds between two DateTime values. SecondsBetween returns the number of whole seconds between ANow and AThen. This means the fractional part of a second (milliseconds etc.) is dropped. Number of seconds between ANow and AThen First moment in time Second moment in time Calculate the number of whole milliseconds between two DateTime values. MillisSecondsBetween returns the number of whole milliseconds between ANow and AThen. This means a fractional part of a millisecond is dropped. Number of milliseconds between ANow and AThen First moment in time Second moment in time Calculate the approximate number of years between two DateTime values. YearSpan returns the number of years between ANow and AThen, including any fractional parts of a year. This number is an approximation, based on an average number of days of 365.25 per year (average over 4 years). Number (fractions included) of years between ANow and AThen First moment in time Second moment in time Calculate the approximate number of months between two DateTime values. MonthSpan returns the number of month between ANow and AThen, including any fractional parts of a month. This number is an approximation, based on an average number of days of 30.4375 per month (average over 4 years). Number (fractions included) of months between ANow and AThen First moment in time Second moment in time Calculate the approximate number of weeks between two DateTime values. WeekSpan returns the number of weeks between ANow and AThen, including any fractional parts of a week. Number (fractions included) of weeks between ANow and AThen First moment in time Second moment in time Calculate the approximate number of days between two DateTime values. DaySpan returns the number of Days between ANow and AThen, including any fractional parts of a Day. Number (fractions included) of days between ANow and AThen First moment in time Second moment in time Calculate the approximate number of hours between two DateTime values. HourSpan returns the number of Hours between ANow and AThen, including any fractional parts of a Hour. Number (fractions included) of hours between ANow and AThen First moment in time Second moment in time Calculate the approximate number of minutes between two DateTime values. MinuteSpan returns the number of minutes between ANow and AThen, including any fractional parts of a minute. Number (fractions included) of minutes between ANow and AThen First moment in time Second moment in time Calculate the approximate number of seconds between two DateTime values. SecondSpan returns the number of seconds between ANow and AThen, including any fractional parts of a second. Number (fractions included) of seconds between ANow and AThen First moment in time Second moment in time Calculate the approximate number of milliseconds between two DateTime values. MilliSecondSpan returns the number of milliseconds between ANow and AThen. Since millisecond is the smallest fraction of a TDateTime indication, the returned number will always be an integer value. Number (fractions included) of seconds between ANow and AThen First moment in time Second moment in time Increase a DateTime value with a number of years. IncYear adds ANumberOfYears years to AValue and returns the resulting date/time. ANumberOfYears can be positive or negative. DateTime representing AValue plus ANumberOfYears years. DateTime to which years should be added. Number of years to add Number of weeks to add Increase a DateTime value with a number of weeks. IncWeek adds ANumberOfWeeks weeks to AValue and returns the resulting date/time.ANumberOfWeeks can be positive or negative. DateTime representing AValue plus ANumberOfWeeks weeks. DateTime to which weeks should be added. Number of days to add. Increase a DateTime value with a number of days. IncDay adds ANumberOfDays days to AValue and returns the resulting date/time.ANumberOfDays can be positive or negative. DateTime representing AValue plus ANumberOfDays days. DateTime value to which days should be added. Number of hours to add Increase a DateTime value with a number of hours. IncHour adds ANumberOfHours hours to AValue and returns the resulting date/time.ANumberOfHours can be positive or negative. DateTime representing AValue plus ANumberOfHours hours. DateTime to which hours should be added. Number of minutes to add Increase a DateTime value with a number of minutes. IncMinute adds ANumberOfMinutes minutes to AValue and returns the resulting date/time.ANumberOfMinutes can be positive or negative. DateTime representing AValue plus ANumberOfMinutes minutes. DateTime to which minutes should be added. Number of seconds to add Increase a DateTime value with a number of seconds. IncSecond adds ANumberOfSeconds seconds to AValue and returns the resulting date/time.ANumberOfSeconds can be positive or negative. DateTime representing AValue plus ANumberOfSeconds seconds. DateTime to which seconds should be added. Number of milliseconds to add Increase a DateTime value with a number of milliseconds. IncMilliSecond adds ANumberOfMilliSeconds milliseconds to AValue and returns the resulting date/time.ANumberOfMilliSeconds can be positive or negative. DateTime representing AValue plus ANumberOfMilliSeconds milliseconds. DateTime to which milliseconds should be added. Encodes a DateTime value from all its parts

EncodeDateTime encodes the values AYear AMonth, ADay,AHour, AMinute,ASecond and AMilliSecond to a date/time valueand returns this value.

For an example, see .

If any of the arguments is not valid, then an EConvertError exception is raised.
DateTime value representing the complete timestamp Year Month Day of the month Hour of the day Minutes Seconds Milliseconds Decode a datetime value in a date and time value DecodeDateTime decomposes the date/time indication in AValue and returns the various components in AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond DateTime to decode Returns the year part of AValue. Returns the month part of AValue. Returns the day part of AValue. Returns the hour part of AValue. Returns the minute part of AValue. Returns the second part of AValue. Returns the millisecond part of AValue. Encode a Year, Month, Day, Hour, minute, seconds, milliseconds tuplet to a TDateTime value

EncodeDateTime encodes the values AYear AMonth, ADay,AHour, AMinute,ASecond and AMilliSecond to a date/time valueand returns this value in AValue.

If the date was encoded succesfully, True is returned, False is returned if one of the arguments is not valid.

True if the encoding was succesful Year Month in year Day in month Hour of the day Minutes in the hour Seconds in the minute Millisecond in the second Encoded TDateTime value. Encode a TDateTime value from a year, week and day of week triplet

EncodeDateWeek encodes the values AYear, AWeekOfYear and ADayOfWeek to a date value and returns this value.

For an example, see .

If any of the arguments is not valid, then an EConvertError exception is raised.
DateTime value representing AYear, AWeekOfYear and ADayOfWeek. Year part Week of the year part Decode a DateTime value in a week of year and day of week. DecodeDateWeek decomposes the date indication in AValue and returns the various components in AYear, AWeekOfYear, ADayOfWeek. DateTime to decode Returns the year part of AValue. Returns the week of year part of AValue. Returns the day of week part of AValue. Encode a year, week and day of week triplet to a TDateTime value

TryEncodeDateWeek encodes the values AYear, AWeekOfYear and ADayOfWeek to a date value and returns this value in AValue.

If the encoding was succcesful, True is returned. False is returned if any of the arguments is not valid.

True if the encoding was succeful, False otherwise. Year Week in the year Encoded TDateTime value Day of the week (default 1). Encodes a year and day of year to a DateTime value

EncodeDateDay encodes the values AYear and ADayOfYear to a date value and returns this value.

For an example, see .

If any of the arguments is not valid, then an EConvertError exception is raised.
DateTime value representing the date specified by AYear and ADayOfYear. Year part. Day of the year part Decode a DateTime value in year and year of day. DecodeDateDay decomposes the date indication in AValue and returns the various components in AYear, ADayOfYear. DateTime to decode Returns the year part of AValue Returns the day-of-year part of AValue Encode a year and day of year to a TDateTime value

TryEncodeDateDay encodes the values AYear and ADayOfYear to a date value and returns this value in AValue.

If the encoding was succcesful, True is returned. False is returned if any of the arguments is not valid.

True if the encoding was succesful, False if not. Year Day in the year Encoded TDateTime value. Encodes a year, month, week of month and day of week to a DateTime value

EncodeDateTime encodes the values AYear AMonth, WeekOfMonth,ADayOfWeek, to a date value and returns this value.

For an example, see .

If any of the arguments is not valid, then an EConvertError exception is raised.
DateTime value representing the date specified by AYear, AMonth, AWeekOfMonth and ADayOfWeek. Year part Month part Week of the month part Day of the week part Decode a DateTime value in a month, week of month and day of week DecodeDateMonthWeek decomposes the date indication in AValue and returns the various components in AYear, AMonth AWeekOfMonth and ADayOfWeek. DateTime to decode Returns the year part of AValue. Returns the month part of AValue. Returns the week of month part of AValue. Returns the day of week part of AValue. Encode a year, month, week of month and day of week to a TDateTime value

TryEncodeDateTime encodes the values AYear AMonth, WeekOfMonth,ADayOfWeek, to a date value and returns this value in AValue.

If the encoding was succesful, True is returned, False if any of the arguments is not valid.

True if the encoding was succesful, False if not. Year Month in the year Week in the month Day in the week Encoded TDateTime value Replace year part of a TDateTime value with another year. RecodeYear replaces the year part of the timestamp AValue with AYear. All other parts of the date/time stamp are left untouched. If the AYear value is not within a valid range (1..9999) then an EConvertError exception is raised. AValue with replaced year. Date to recode Year to replace in AValue Replace month part of a TDateTime value with another month. RecodeMonth replaces the Month part of the timestamp AValue with AMonth. All other parts of the date/time stamp are left untouched. If the AMonth value is not within a valid range (1..12) then an EConvertError exception is raised. AValue with replaced month. Date to recode Month to replace in AValue Replace day part of a TDateTime value with another day. RecodeDay replaces the Day part of the timestamp AValue with ADay. All other parts of the date/time stamp are left untouched. If the ADay value is not within a valid range (1..12) then an EConvertError exception is raised. AValue with replaced day. Date to recode Day to replace in AValue Replace hours part of a TDateTime value with another hour. RecodeHour replaces the Hour part of the timestamp AValue with AHour. All other parts of the date/time stamp are left untouched. If the AHour value is not within a valid range (0..23) then an EConvertError exception is raised. AValue with replaced hour. Date/time to recode Hour to replace in AValue Replace minutse part of a TDateTime value with another minute. RecodeMinute replaces the Minute part of the timestamp AValue with AMinute. All other parts of the date/time stamp are left untouched. If the AMinute value is not within a valid range (0..59) then an EConvertError exception is raised. AValue with replaced minute. Date/time to recode Minute to replace in AValue Replace seconds part of a TDateTime value with another second. RecodeSecond replaces the Second part of the timestamp AValue with ASecond. All other parts of the date/time stamp are left untouched. If the ASecond value is not within a valid range (0..59) then an EConvertError exception is raised. AValue with replaced second. Date/time to recode Second to replace in AValue Replace milliseconds part of a TDateTime value with another millisecond. RecodeMilliSecond replaces the millisecond part of the timestamp AValue with AMilliSecond. All other parts of the date/time stamp are left untouched. If the AMilliSecond value is not within a valid range (0..999) then an EConvertError exception is raised. AValue with replaced millisecond. Date/time to recode Millisecond to replace in AValue Replace date part of a TDateTime value with another date. RecodeDate replaces the date part of the timestamp AValue with the date specified in AYear, AMonth, ADay. All other parts (the time part) of the date/time stamp are left untouched. If one of the AYear, AMonth, ADay values is not within a valid range then an EConvertError exception is raised. AValue with replaced date. Date/time to recode Year to replace in AValue Month to replace in AValue Day to replace in AValue Replace time part of a TDateTime value with another time. RecodeTime replaces the time part of the timestamp AValue with the date specified in AHour, AMinute, ASecond and AMilliSecond. All other parts (the date part) of the date/time stamp are left untouched. If one of the values AHour, AMinute, ASecond AMilliSecond is not within a valid range then an EConvertError exception is raised. AValue with replaced time. Date/time to recode Hour to replace in AValue Minute to replace in AValue Second to replace in AValue Millisecond to replace in AValue Replace selected parts of a TDateTime value with other values RecodeDateTime replaces selected parts of the timestamp AValue with the date/time values specified in AYear, AMonth, ADay, AHour, AMinute, ASecond and AMilliSecond. If any of these values equals the pre-defined constant , then the corresponding part of the date/time stamp is left untouched. If one of the values AYear, AMonth, ADay, AHour, AMinute, ASecond AMilliSecond is not within a valid range (RecodeLeaveFieldAsIs excepted) then an EConvertError exception is raised. AValue with replaced parts Date/time to recode New value for year part New value for month part New value for day part New value for hour part New value for minute part New value for second part New value for millisecond part Replace selected parts of a TDateTime value with other values

TryRecodeDateTime replaces selected parts of the timestamp AValue with the date/time values specified in AYear, AMonth, ADay, AHour, AMinute, ASecond and AMilliSecond. If any of these values equals the pre-defined constant , then the corresponding part of the date/time stamp is left untouched.

The resulting date/time is returned in AValue.

The function returns True if the encoding was succesful. It returns False if one of the values AYear, AMonth, ADay, AHour, AMinute, ASecond AMilliSecond is not within a valid range.

True if the recoding was succesful, False if not. Date/time to recode New value for year part New value for month part New value for day part New value for hour part New value for minute part New value for second part New value for millisecond part Recoded AValue. Compare 2 dates, taking into account the time of day

CompareDateTime compares two timestamps A and B and returns the following results:

< 0
if A is earlier in date/time than B.
0
if A and B are the same date/time .
> 0
if A is later in date/time than B.
A negative number if A is earlier than B, zero if they are equal, or positive if A is later than B. First date-time to compare First date-time to compare Compare 2 dates, disregarding the time of day

CompareDate compares the date parts of two timestamps A and B and returns the following results:

< 0
if the day part of A is earlier than the day part of B.
0
if A and B are the on same day (times may differ) .
> 0
if the day part of A is later than the day part of B.
A negative number if date A is before B, zero if they are equal, or positive if A is after B. First date to compare Second date to compare Compares two times of the day, disregarding the date part.

CompareTime compares the time parts of two timestamps A and B and returns the following results:

< 0
if the time part of A is earlier than the time part of B.
0
if A and B have the same time part (dates may differ) .
> 0
if the time part of A is later than the time part of B.
A negative number if A is before B, zero if they are equal, or positive A is later than B. First time to compare Second time to compare Check whether two TDateTime values have the same date and time parts.

SameDateTime compares the date/time parts of two timestamps A and B and returns True if they are equal, False if they are not.

The function simply checks whether returns zero.

True if A and B have the same date and time parts, False if not. First DateTime value Second DateTime value Check whether two TDateTime values have the same date part.

SameDate compares the date parts of two timestamps A and B and returns True if they are equal, False if they are not.

The function simply checks whether returns zero.

True if A and B have the same time part, False if not First DateTime value Second DateTime value Check whether two TDateTime values have the same time part.

SameTime compares the time parts of two timestamps A and B and returns True if they are equal, False if they are not.

The function simply checks whether returns zero.

True if A and B have the same time part, False if not. First DateTime value Second DateTime value Calculate which occurrence of weekday in the month a given day represents NthDayOfWeek returns the occurence of the weekday of AValue in the month. This is the N-th time that this weekday occurs in the month (e.g. the third saturday of the month). Occurrence of weekday in the month of AValue. Date to check. Decode a DateTime value in year, month, day of week parts DecodeDayOfWeekInMonth decodes the date AValue in a AYear, AMonth, ADayOfweek and ANthDayOfweek. (This is the N-th time that this weekday occurs in the month, e.g. the third saturday of the month.) DateTime to decode Returns the year part of AValue. Returns the month part of AValue. Returns which ADayofWeek of AValue. Returns the day of week part of AValue. Encodes a year, month, week, day of week specification to a TDateTime value

EncodeDayOfWeekInMonth encodes AYear, AMonth, ADayOfweek and ANthDayOfweek to a valid date stamp and returns the result.

ANthDayOfweekis the N-th time that this weekday occurs in the month, e.g. the third saturday of the month.

For an example, see .

If any of the values is not in range, then an EConvertError exception will be raised.
TDateTime value representing AYear , AMonthANthDayOfWeek .and ADayOfWeek. Year Month in the year Week in the month Day of the week Encode a year, month, week, day of week triplet to a TDateTime value

EncodeDayOfWeekInMonth encodes AYear, AMonth, ADayOfweek and ANthDayOfweek to a valid date stamp and returns the result in AValue.

ANthDayOfweekis the N-th time that this weekday occurs in the month, e.g. the third saturday of the month.

The function returns True if the encoding was succesful, False if any of the values is not in range.

True if the encoding was succesful, False if not. Year Month in year Day of week occurrence Day of week Resulting TDateTime value Base date time to use when creating the string representing the date/time. Default 0 Raise an EConvertError about an invalid date-time specification.

InvalidDateTimeError raises an EConvertError exception and formats the error message with an appropriate description made up from the parts AYear, AMonth, ADay,AHour, AMinute, ASecond and AMilliSecond.

Normally this function should not be needed, the conversion routines call it when they have received invalid arguments.

Year Month in the year Day of the month Hour of the day Minute of the hour Seconds in the minute Milliseconds in second Raise an EConvertError with an invalid Year, WeekOfyear and DayOfWeek specification

InvalidDateWeekError raises an EConvertError exception and formats the error message with an appropriate description made up from the parts AYear, AWeek, ADayOfWeek

Normally this function should not be needed, the conversion routines call it when they have received invalid arguments.

The year The week The day of theweek Raise an EConvertError exception when a day is not a valid day of a year.

InvalidDateDayError raises an EConvertError exception and formats the error message with an appropriate description made up from the parts AYear and ADayOfYear.

Normally this function should not be needed, the conversion routines call it when they have received invalid arguments.

Year Invalid day of the year. Raise an EConvertError exception when a Year,Month,WeekOfMonth,DayofWeek is invalid.

InvalidDateMonthWeekError raises an EConvertError exception and formats the error message with an appropriate description made up from the parts AYear, Amonth, AWeekOfMonth and ADayOfWeek.

Normally this function should not be needed, the conversion routines call it when they have received invalid arguments.

Year Month of the year Week of the month Day of the week Raise an EConvertError exception when a Year,Month,NthDayofWeek,DayofWeek is invalid.

InvalidDayOfWeekInMonthError raises an EConvertError exception and formats the error message with an appropriate description made up from the parts AYear, Amonth, ANthDayOfWeek and ADayOfWeek.

Normally this function should not be needed, the conversion routines call it when they have received invalid arguments.

Year Month in the year Nth occurrence of day of week. Day of week. Converts a TDateTime value to a Julian date representation Not yet implemented. Currently, trying to use this function will raise an exception. Julian representation of AValue. DateTime value to convert to Julian representation Convert a Julian date representation to a TDateTime value. Not yet implemented. Currently, trying to use this function will raise an exception. Resulting TDateTime Date in Julian notation Convert a Julian date representation to a TDateTime value. Not yet implemented. Currently, trying to use this function will raise an exception. True if the conversion was succesful, False if not. Date in Julian notation Resulting TDateTime equivalent Convert a TDateTime value to a modified Julian date representation Not yet implemented. Currently, trying to use this function will raise an exception. Modified Julian representation of AValue. DateTime value to convert to Modified Julian representation Convert a modified Julian date representation to a TDateTime value. Not yet implemented. Currently, trying to use this function will raise an exception. AValue in modified Julian date notation. Date to convert Convert a modified Julian date representation to a TDateTime value. Not yet implemented. Currently, trying to use this function will raise an exception. True if the conversion was succesful, False if not. Modified Julian date to convert AValue as a TDateTime value. Convert a TDateTime value to Unix epoch time Not yet implemented. Currently, trying to use this function will raise an exception. Unix epoch time corresponding to AValue DateTime value to convert Convert Unix epoch time to a TDateTime value Not yet implemented. Currently, trying to use this function will raise an exception. AValue as a TDateTime value. Date to convert.