| QESBPCSDateTime Unit Routines |
Description
This is designed to work in Borland Delphi 6 CLX and above, Borland C++ Builder 6 CLX and above, and Borland Kylix 2 and above. Most if not all features will work in Kylix 1 but it is not currently supported.
Copyright © 1999-2002 ESB Consultancy
v2.3 - 14 September 2002
| Routines |
| AddCalendarMonths | Adds a Specified Number of Calendar Months to a Given Date/Time. |
| AddDays | Adds a Floating Point amount of Days to a Given Date/Time. |
| AddFortnights | Adds a Floating Point amount of Fortnights to a Given Date/Time. |
| AddHrs | Adds a Floating Point amount of Hours to a Given Date/Time. |
| AddMins | Adds a Floating Point amount of Minutes to a Given Date/Time. |
| AddMonths | Adds a Floating Point amount of Months to a Given Date/Time. |
| AddQuarters | Adds a Floating Point amount of Quarters to a Given Date/Time. |
| AddSecs | Adds a Floating Point amount of Seconds to a Given Date/Time. |
| AddSemesters | Adds a Floating Point amount of Semesters to a Given Date/Time. |
| AddWeeks | Adds a Floating Point amount of Weeks to a Given Date/Time. |
| AddYrs | Adds a Floating Point amount of Years to a Given Date/Time. |
| AdjustDateYear | Adjusts the date so that it has the Year specified. |
| AgeAtDate | Returns the Age (in years) of a "person" given their Date of Birth (DOB) and the Date of Reference (DT). |
| AgeAtDateInMonths | Returns the Age (in months) of a "person" given their Date of Birth (DOB) and the Date of Reference (DT). |
| AgeAtDateInWeeks | Returns the Age (in weeks) of a "person" given their Date of Birth (DOB) and the Date of Reference (DT). |
| AgeNow | Returns the current Age (in years) of a "person" given their Date of Birth (DOB) using the System Date. |
| AgeNowInMonths | Returns the current Age (in months) of a "person" given their Date of Birth (DOB) using the System Date. |
| AgeNowInWeeks | Returns the current Age (in weeks) of a "person" given their Date of Birth (DOB) using the System Date. |
| CalendarMonthsApart | Returns the Number of Calendar Months between DT2 and DT1. |
| CalendarWeeksApart | Returns the Number of Calendar Weeks between DT2 and DT1. |
| Date2AccessStr | Returns Date as a string suitable for MS Access Date comparisons, ie #MM/DD/YYYY#. |
| Date2ANSISQLStr | Returns Date as a string suitable for ANSI Standard comparisons, ie { d 'YYYY-MM-DD' } |
| Date2Day | Returns the Day of the Month number from a given date/time. |
| Date2DigitStr | Returns Date as a String in the format YYYYMMDD. |
| Date2FormatStr | Returns Date as a String using Format. |
| Date2ISOEnhStr | Returns Date as a Basic Format for ISO Dates: YYYY-MM-DD where YYYY is year, MM is the Month, DD is Day of Month. |
| Date2ISOInt | Returns Date as a Basic Format for ISO Dates: YYYYMMDD where YYYY is year, MM is the Month, DD is Day of Month. |
| Date2ISOStr | Returns Date as a Basic Format for ISO Dates: YYYYMMDD where YYYY is year, MM is the Month, DD is Day of Month. |
| Date2ISOWeekEnhStr | Returns Date as a Enhanced Format for ISO Calendar Week/Day: YYYY-Www-D where YYYY is year, 'W' is literal, ww is weekno and D is the ISO Day of Week - Monday is First Day. |
| Date2ISOWeekNo | Converts Dates into a Week No and Year according to ISO-8601. |
| Date2ISOWeekOnlyEnhStr | Returns Date as a Enhanced Format for ISO Calendar Week: YYYY-Www where YYYY is year, 'W' is literal, ww is weekno. |
| Date2ISOWeekOnlyStr | Returns Date as a Basic Format for ISO Calendar Week: YYYYWww where YYYY is year, 'W' is literal, ww is weekno. |
| Date2ISOWeekStr | Returns Date as a Basic Format for ISO Calendar Week/Day: YYYYWwwD where YYYY is year, 'W' is literal, ww is weekno and D is the ISO Day of Week - Monday is First Day. |
| Date2LongDOW | Returns the Long Day of Week Description for the supplied Date. |
| Date2LongMonth | Returns the Long Month Description for the supplied Date. |
| Date2Month | Returns the Month number from a given date/time, 1 = Jan, etc. |
| Date2ShortDOW | Returns the Short Day of Week Description for the supplied Date. |
| Date2ShortMonth | Returns the Short Month Description for the supplied Date. |
| Date2ShortMonthYY | Returns the Short Month Description for the supplied Date followed by a space then the last two digits of the year. |
| Date2ShortMonthYYYY | Returns the Short Month Description for the supplied Date followed by a space then the year. |
| Date2StarSign | Returns the Star Sign (Astrology) for the Given Date. |
| Date2Str | Returns Date as a String using ShortDateFormat from Regional Settings. |
| Date2WeekNo | Converts Dates into a Week No in the Current Year. |
| Date2Year | Returns the Year from a given date/time. |
| Date2YearMonth | Returns the (Year * 100 + Month) number for a given date/time, 3 Mar 2000 would give 200003 |
| DatesInSameISOWeekNo | |
| DatesInSameMonth | Returns true if both DateTimes refer to the same Calendar Month, can have different years. |
| DatesInSameMonthYear | Returns true if both DateTimes refer to the exact same Month, cannot have different years. |
| DatesInSameWeekNo | Returns true if the two Dates are in the same WeekNo. |
| DatesInSameYear | Returns true if both DateTimes refer to the same Year. |
| DateTime2FormatStr | Returns Date/Time as a String using Format. |
| DayName2DOW | Given a Day Name this routines searches through the Short and then Long Day Names supplied in the Registry to do a Left Match, and then return the Day Number. |
| DayOfMonth2Date | Returns the Given Occurrence (Day of Month) of a Day of Week in a given Month/Year. |
| DayOfYear | Returns the Day Number in the Year represented by the given Date. |
| Days2Fortnights | Returns the number of Fortnights the specified number of Days represents. |
| Days2Hrs | Returns the number of Hours the specified number of Days represents. |
| Days2Mins | Returns the number of Minutes the specified number of Days represents. |
| Days2Months | Returns the number of Months the specified number of Days represents. |
| Days2Secs | Returns the number of Seconds the specified number of Days represents. |
| Days2SiderealDays | Converts "normal" 24-hour Days into Sidereal Days. |
| Days2Weeks | Returns the number of Weeks the specified number of Days represents. |
| Days2Years | Returns the number of Years the specified number of Days represents. |
| Days2YearsGregorian | Returns the number of Years the specified number of Days represents. |
| Days2YearsJulian | Returns the number of Years the specified number of Days represents. |
| DaysApart | Returns the Number of Days between DT2 and DT1. |
| DaysInMonth | Returns the number of days in the Month represented by the given Date. |
| DaysInThisMonth | Returns the number of days in the current Month. |
| DaysInYear | Returns the number of days in the Year represented by the given Date. |
| DaysLeftInMonth | Returns the Number of days left in the Month represented by the given Date. |
| DaysLeftInThisMonth | Returns the number of days left in the current Month. |
| DaysLeftInThisYear | Returns the number of days left in this Year. |
| DaysLeftInYear | Returns the number of days left in the Year represented by the given Date. |
| DigitStr2Date | Converts a string containing a Date into a DateTime. |
| DOW2ESBDayOfWeek | |
| DOW2ISODOW | Converts a Delphi Day of Week into an ISO-8601 Day Of Week. |
| DOWsInMonth | Returns the number of the specified Day of Week in the Given Month/Year. |
| DOWsInRange | Returns the number of the specified Day of Week in the Given Date Range (inclusive). |
| DWY2Date | Returns the Date for a given Day of Week, a given WeekNo, and the given Year, assuming that the Start of the Week is Sunday, and that DOW uses 1 for Sunday. |
| EndOfISOWeek | Returns the End of the week containing given Date/Time, assumes that the End of the Week is Sunday according to ISO-8601 - Time portion preserved. |
| EndOfISOWeekNo | Returns the End of the Week for the given ISO-8601 WeekNo in the given year. |
| EndOfWeek | Returns the End of the week containing given Date/Time, assumes that the End of the Week is Saturday - Time portion preserved. |
| EndOfWeekNo | Returns the End of the Week for the given WeekNo in the given year, assuming that the End of the Week is Saturday. |
| ESBDayOfWeek2DOW | |
| ESBDayOfWeek2ISODOW | |
| ESBDecodeDate | An Enhanced DecodeDate that includes Exception Handling. |
| ESBDecodeTime | An Enhanced EncodeTime that includes Exception Handling. |
| ESBEncodeDate | An Enhanced EncodeDate that includes Exception Handling. |
| ESBEncodeTime | An Enhanced EncodeTime that includes Exception Handling. |
| ESBMonth2Month | |
| ESBToday | A Speed Optimised Routine to get the Current Date. |
| ESBTomorrow | A Speed Optimised Routine to get the Tomorrow's Date. |
| ESBYesterday | A Speed Optimised Routine to get the Yesterday's Date. |
| ExactWeeksApart | Returns the Exact Number of Weeks between DT2 and DT1. |
| Fortnights2Days | Returns the number of Days the specified number of Fortnights represents. |
| GetChristmasDay | Returns Christmas Day, for a given Year. |
| GetDateTimeStamp | Returns the current date/time as a string in the Format of: YYYYMMDD-HHMMSSmmm. |
| GetEasterSunday | Returns the Date of Easter Sunday for given Year - based on current Calendar. |
| GetEpact | Return the Epact, which is a measure of the age of the moon (ie the number of days that have passed since an "official" new moon) on a particular date. |
| GetESBDateOrder | Identifies which of the three common formats for Date Order that a given Date Format is in. |
| GetFirstDayOfMonth | Returns First Day of the Month, for a given Date/Time - Time portion preserved. |
| GetFirstDayOfQuarter | Returns First Day of the Quarter, for a given Date/Time - Time portion, preserved or Returns First Day of the Quarter, for a given Quarter and Year. |
| GetFirstDayOfYear | Returns First Day of the Year, for a given Year. |
| GetFirstMondayOfYear | Returns First Monday of the Year, for a given Year. |
| GetFirstSundayOfYear | Returns First Sunday of the Year, for a given Year. |
| GetGoldenNumber | Returns the GoldenNumber for a given Year. |
| GetGoodFriday | Returns the Date of Good Friday for given Year - based on current Calendar. |
| GetLastDayOfMonth | Returns Last Day of the Month, for a given Date/Time - Time portion preserved. |
| GetLastDayOfQuarter | Returns Last Day of the Quarter, for a given Date/Time - Time portion preserved or Returns Last Day of the Quarter, for a given Quarter and Year. |
| GetLastDayOfYear | Returns Last Day of the Year, for a given Year. |
| Hrs2Days | Returns the number of Days the specified number of Hours represents. |
| Hrs2Mins | Returns the number of Minutes the specified number of Hours represents. |
| Hrs2Secs | Returns the number of Seconds the specified number of Hours represents. |
| IsAM | Returns True if the Time portion is a AM value. |
| IsAMNow | Returns True if the currnet Time is a AM value. |
| IsApril | Returns True if the given Date's Month is April. |
| IsAprilNow | Returns True if today's Month is April. |
| IsAugust | Returns True if the given Date's Month is August. |
| IsAugustNow | Returns True if today's Month is August. |
| IsDecember | Returns True if the given Date's Month is December. |
| IsDecemberNow | Returns True if todays Month is December. |
| IsFebruary | Returns True if the given Date's Month is February. |
| IsFebruaryNow | Returns True if today's Month is February. |
| IsFirstDayOfMonth | Returns true if the date is the first day of a Month. |
| IsFirstDayOfMonthNow | Returns true if today is the first day of a Month. |
| IsFirstDayOfYear | Returns true if the date is the first day of a Year. |
| IsFirstDayOfYearNow | Returns true if today is the first day of a Year. |
| IsFriday | Returns True if the Date represents a Friday. |
| IsFridayNow | Returns True if today is a Friday. |
| IsJanuary | Returns True if the given Date's Month is January. |
| IsJanuaryNow | Returns True if today's Month is January. |
| IsJuly | Returns True if the given Date's Month is July. |
| IsJulyNow | Returns True if today's Month is July. |
| IsJune | Returns True if the given Date's Month is June. |
| IsJuneNow | Returns True if today's Month is June. |
| IsLastDayOfMonth | Returns true if the date is the last day of a Month. |
| IsLastDayOfMonthNow | Returns true if today is the last day of a Month. |
| IsLastDayOfYear | Returns true if the date is the last day of a Year. |
| IsLastDayOfYearNow | Returns true if today is the last day of a Year. |
| IsLeapYear | Is given Year a Leap Year. |
| IsMarch | Returns True if the given Date's Month is March. |
| IsMarchNow | Returns True if today's Month is March. |
| IsMay | Returns True if the given Date's Month is May. |
| IsMayNow | Returns True if today's Month is May. |
| IsMidnight | Returns True if the Time portion represents Midnight, 12:00am. |
| IsMidnightNow | Returns True if the current Time represents Midnight, 12:00am. |
| IsMonday | Returns True if the Date represents a Monday. |
| IsMondayNow | Returns True if today is a Monday. |
| IsNoon | Returns True if the Time portion represents Noon, 12:00pm. |
| IsNoonNow | Returns True if the current Time represents Noon, 12:00pm. |
| IsNovember | Returns True if the given Date's Month is November. |
| IsNovemberNow | Returns True if today's Month is November. |
| IsOctober | Returns True if the given Date's Month is October. |
| IsOctoberNow | Returns True if today's Month is October. |
| ISODayOfWeek | Returns Day Of Week According to ISO-8601 which has Monday as 1 and Sunday as 7. |
| ISODOW2DOW | Converts an ISO-8601 Day of Week into a Delphi Day Of Week. |
| ISODOW2ESBDayOfWeek | |
| ISOWeekNosApart | |
| ISOWeeksApart | Returns the Number of ISO Weeks between DT2 and DT1. |
| ISOWeeksInYear | Most years have 52 weeks, but years that start on a Thursday and leap years that start on a Wednesday (or Thursday) have 53 weeks. |
| ISOYWD2Date | Returns the Date for a given Day of Week, a given WeekNo, and the given Year, as defined in ISO-8601. |
| IsPM | Returns True if the Time portion is a PM value. |
| IsPMNow | Returns True if the current Time is a PM value. |
| IsSaturday | Returns True if the Date represents a Saturday. |
| IsSaturdayNow | Returns True if today is a Saturday. |
| IsSeptember | Returns True if the given Date's Month is September. |
| IsSeptemberNow | Returns True if today's Month is September. |
| IsSunday | Returns True if the Date represents a Sunday. |
| IsSundayNow | Returns True if today is a Sunday. |
| IsThursday | Returns True if the Date represents a Thursday. |
| IsThursdayNow | Returns True if today is a Thursday. |
| IsTuesday | Returns True if the Date represents a Tuesday. |
| IsTuesdayNow | Returns True if today is a Tuesday. |
| IsValidLongDOW | Returns True if DOW can be found in the Long Day Names from the Regional Settings. |
| IsValidLongMonth | Returns True if Month can be found in the Long Months from the Regional Settings. |
| IsValidShortDOW | Returns True if DOW can be found in the Short Day Names from the Regional Settings. |
| IsValidShortMonth | Returns True if Month can be found in the Short Months from the Regional Settings. |
| IsWednesday | Returns True if the Date represents a Wednesday. |
| IsWednesdayNow | Returns True if today is a Wednesday. |
| IsWeekday | Returns True if the Date represents Monday through Friday. |
| IsWeekdayNow | Returns True if today is Monday through Friday. |
| IsWeekend | Returns True if the Date represents Saturday or Sunday. |
| IsWeekendNow | Returns True if today is Saturday or Sunday. |
| IsWorkingDay | Returns True if the specified Date is a Working Day. |
| Mins2Days | Returns the number of Days the specified number of Minutes represents. |
| Mins2Hrs | Returns the number of Hours the specified number of Mintues represents. |
| Mins2Secs | Returns the number of Minutes the specified number of Seconds represents. |
| MinutesApart | Returns the number of whole minutes apart the two times are (date portion ignored) and DT1 is assumed to be before DT2. |
| Month2ESBMonth | |
| MonthName2Month | Given a Month Name this routines searches through the Short and then Long Month Names supplied in the Registry to do a Left Match, and then return the Month Number. |
| Months2Days | Returns the number of Days the specified number of Months represents. |
| MS2TimeStr | Converts a time in MilliSeconds to a string of the form 'H:MM:SS.mmm'. |
| OptDate | A Speed Optimised Routine to get the Current Date. |
| OptDate2Day | A Speed Optimised Routine for getting the Day portion of a Date based on Routine by Ken Otto that is many times faster than using DecodeDate in SysUtils. |
| OptDate2Month | A Speed Optimised Routine for getting the Month portion of a Date based on Routine by Ken Otto that is many times faster than using DecodeDate in SysUtils. |
| OptDate2Year | A Speed Optimised Routine for getting the Year portion of a Date based on Routine by Ken Otto that is many times faster than using DecodeDate in SysUtils. |
| OptDayOfYear | Returns the Day Number in the Year represented by the given Date. |
| OptDaysLeftInThisYear | Returns the number of days left in this Year. |
| OptDaysLeftInYear | Returns the number of days left in the Year represented by the given Date. |
| OptDecodeDateI | A Speed Optimised DecodeDate developed by Ken Otto that is many times faster than the once included in SysUtils. |
| OptDecodeDateW | A Speed Optimised DecodeDate developed by Ken Otto that is many times faster than the once included in SysUtils. |
| OptEncodeDateI | A Speed Optimised EncodeDate developed by Ken Otto that is many times faster than the once included in SysUtils, and includes Exception Handling. |
| OptEncodeDateW | A Speed Optimised EncodeDate developed by Ken Otto that is many times faster than the once included in SysUtils, and includes Exception Handling. |
| OptThisDay | Returns the current Day - from Today's Date. |
| OptThisDayOfYear | Returns the Day Number in this Year represented by today. |
| OptThisMonth | Returns the current Month - from Today's Date. |
| OptThisYear | Returns the current Year - from Today's Date. |
| SameDate | Returns True if they are both the same Date ignoring the Time portion. |
| SameDateTime | Returns True if they are both the same Date/Time. |
| SameTime | Returns True if they are both the same Time ignoring the Date portion. |
| Secs2Days | Returns the number of Days the specified number of Seconds represents. |
| Secs2Hrs | Returns the number of Hours the specified number of Seconds represents. |
| Secs2Mins | Returns the number of Seconds the specified number of Mintues represents. |
| SiderealDays2Days | Converts Sidereal Days into "normal" 24-hour Days. |
| StartOfISOWeek | Returns the Start of the week containing given Date/Time, assumes that the Start of the Week is Monday according to ISO-8601 - Time portion preserved. |
| StartOfISOWeekNo | Returns the Start of the Week for the given ISO-8601 WeekNo in the given year. |
| StartOfWeek | Returns the Start of the week containing given Date/Time, assumes that the Start of the Week is Sunday - Time portion preserved. |
| StartOfWeekNo | Returns the Start of the Week for the given WeekNo in the given year, assuming that the Start of the Week is Sunday. |
| Str2CutOffDate | Converts a string containing a Date into a DateTime. |
| Str2Date | Converts a string containing a Date into a DateTime. |
| Str2HistoricDate | Converts a string containing a Date into a DateTime. |
| Str2Time | Converts a string containing a Time into a DateTime. |
| StrFormat2Date | Converts a string containing a Date into a DateTime. |
| SubtractDays | Subtracts a Floating Point amount of Days from a Given Date/Time. |
| SubtractFortnights | Subtracts a Floating Point amount of Fortnights from a Given Date/Time. |
| SubtractHrs | Subtracts a Floating Point amount of Hours from a Given Date/Time. |
| SubtractMins | Subtracts a Floating Point amount of Minutes from a Given Date/Time. |
| SubtractMonths | Subtracts a Floating Point amount of Months from a Given Date/Time. |
| SubtractQuarters | Subtracts a Floating Point amount of Quarters from a Given Date/Time. |
| SubtractSecs | Subtracts a Floating Point amount of Seconds from a Given Date/Time. |
| SubtractSemesters | Subtracts a Floating Point amount of Semesters from a Given Date/Time. |
| SubtractWeeks | Subtracts a Floating Point amount of Weeks from a Given Date/Time. |
| SubtractYrs | Subtracts a Floating Point amount of Years from a Given Date/Time. |
| ThisDay | Returns the current Day - from Today's Date. |
| ThisDayOfYear | Returns the Day Number in this Year represented by today. |
| ThisDOW | Returns the current Day of the week from Today's Date. |
| ThisHr | Returns the current Hour - from the current Time. |
| ThisISODOW | Returns the current Day of the week from Today's Date, according to ISO-8601 which has Monday as 1 and Sunday as 7. |
| ThisISOWeekNo | Returns the ISO-8601 WeekNo of the current Date (System Date). |
| ThisMin | Returns the current Minute - from the current Time. |
| ThisMonth | Returns the current Month - from Today's Date. |
| ThisMSec | Returns the current Millisecond - from the current Time. |
| ThisSec | Returns the current Second - from the current Time. |
| ThisWeekNo | Returns the WeekNo of the current Date (System Date). |
| ThisYear | Returns the current Year - from Today's Date. |
| Time2FormatStr | Returns Time as a String using Format. |
| Time2Hr | Returns the Hour from a given date/time. |
| Time2Min | Returns the Minute from a given date/time. |
| Time2MSec | Returns the Millisecond from a given date/time. |
| Time2Sec | Returns the Second from a given date/time. |
| Time2Str | Returns the Time Portion as a string HH:MM with time separator from the Regional Settings. |
| TimeApartInDays | Returns the decimal number of Days apart the two date/times are. |
| TimeApartInFortnights | Returns the decimal number of fortnights apart the two date/times are. |
| TimeApartInHrs | Returns the decimal number of hours apart the two date/times are. |
| TimeApartInMins | Returns the decimal number of Minutes apart the two date/times are. |
| TimeApartInSecs | Returns the decimal number of Seconds apart the two date/times are. |
| TimeApartInWeeks | Returns the decimal number of Weeks apart the two date/times are. |
| WeekDaysInMonth | Returns the number of the Week Days (Mon through Fri) in the Given Month/Year. |
| WeekendDaysInMonth | Returns the number of the WeekEnd Days (Sat & Sun) in the Given Month/Year. |
| WeekNosApart | Returns true No of Weeks, based on WeekNo, that the two dates are apart. |
| Weeks2Days | Returns the number of Days the specified number of Weeks represents. |
| WeeksApart | Returns the Number of Weeks between DT2 and DT1. |
| WhichQuarter | Returns 1 if Date in Jan through Mar, 2 if Date in Apr through Jun, 3 if Date in Jul through Sep, 4 if Date in Oct through Dec. |
| WhichSemester | Returns 1 if Date in Jan through Jun or 2 if Date in Jul through Dec. |
| Years2Days | Returns the number of Days the specified number of Years represents. |
| YearsGregorian2Days | Returns the number of Days the specified number of Years represents. |
| YearsJulian2Days | Returns the number of Days the specified number of Years represents. |
|
|