| BaH.DateTime: | Constants | Globals | Functions | Types | Modinfo | Source |
This Blitzmax DateTime module utilizes the BOOST C++ library datetime functions to provide an extensive set of date and time features.
The module allows for control and maipulation of dates, times, periods, durations, time zones and the localization of month and weekday names (both for long and short formats).
The DateTime module requires the BaH.Boost module, which should be available from the same place you found this.
Dates are based on the Gregorian calendar using a "proleptic" system, which extends dates back prior to the Gregorian Calendar's first adoption in 1582. The current implementation supports dates in the range 1400-Jan-01 to 9999-Dec-31. Many references will represent dates prior to 1582 using the Julian Calendar, so caution is in order if accurate calculations are required on historic dates.
Types for date processing include TDate, TPartialDate, TDatePeriod and the abstract TDateIterator (of which TDateDayIterator, TDateMonthIterator and TDateYearIterator are the implementations).
Examples of usage include :
| Example | Description |
|---|---|
| Days Alive Days Between New Years | Simple date arithmetic. Retrieve current day from clock. |
| Date Period Calculations | See if a date is in a set of date periods (eg: is it a holiday/weekend) |
| Print a month | Small utility which prints out all the days in a month from command line. Need to know if 1999-Jan-1 was a Friday or a Saturday? This program shows how to do it. |
| Print Holidays | Uses date generators to convert abstract specification into concrete set of dates. |
The time system defines a non-adjusted time system with nano-second/micro-second resolution and stable calculation properties. This time system uses the Gregorian calendar to implement the date portion of the time representation.
Types for time processing include TTime, TTimeDuration and TTimePeriod.
Examples of usage include :
| Example | Description |
|---|---|
| Time Math | A few simple calculations using TTime and TTimeDurations. |
| Time Periods | Some simple examples of intersection and display of time periods. |
It is possible to localize the month and weekday names using a TDateFacet. This type provides a set of methods to enable the setting of both long and short versions of the texts. The default facet can be overridden by calling SetCurrentDateFacet, passing in the custom facet. Subsequently, all month/weekday output will reflect the new date facet.
To reset the current date facet, you can use the defaultDateFacet as a parameter to SetCurrentDateFacet.
In the locale folder included with the module, is a set of localized month/weekday names in 74 languages, using the .blf format as specified by the BaH.Locale module.
The example, locale_example.bmx shows one way to localize the datetime texts using that module.
| Apr , Aug , Dec , Feb , Fifth , First , Fourth , Friday , Jan , Jul , Jun , Mar , May , Monday , Nov , Oct , Saturday , Second , Sep , Sunday , Third , Thursday , Tuesday , Wednesday |
| defaultDateFacet |
| DaysBeforeWeekday | Calculates the number of day from given date to previous given weekday. |
| DaysUntilWeekday | Calculates the number of days from given date until given weekday. |
| EndOfMonthDay | |
| Month | Get the month text for the specified month (1 - 12). |
| NextWeekday | Generates a TDate object representing the date of the following weekday from the given date. |
| NumFractionalDigits | Returns the number of fractional digits the time resolution has. |
| PreviousWeekday | Generates a TDate object representing the date of the previous weekday from the given date. |
| SetCurrentDateFacet | Sets the current date facet. |
| TDHours | Convenience function for TTimeDuration.Hour(). |
| TDMillisecs | Convenience function for TTimeDuration.Millisecond(). |
| TDMinutes | Convenience function for TTimeDuration.Minute(). |
| TDSeconds | Convenience function for TTimeDuration.Second(). |
| TicksPerSecond | Return the number of ticks in a second. |
| WeekDay | Get the weekday text for the specified weekday (0 - 6). |
| TDate | The primary interface for date programming. |
| TDateDayIterator | A TDateIterator for stepping over days. |
| TDateFacet | The TDateFacet enables users to have significant control over the output of dates (and other gregorian objects). |
| TDateIterator | Base type for date iterators. |
| TDateMonthIterator | A TDateIterator for stepping over months. |
| TDatePeriod | TDatePeriod provides direct representation for ranges between two dates. |
| TDateYearIterator | A TDateIterator for stepping over years. |
| TFirstDayOfWeekAfter | Date Generator for first day of the week after a date. |
| TFirstDayOfWeekBefore | Date Generator for first day of the week before a date. |
| TFirstDayOfWeekInMonth | Date Generator for first day of the week in month. |
| TLastDayOfWeekInMonth | Date Generator for last day of the week in month. |
| TLocalDateTime | A TLocalDateTime object is a point in time and an associated time zone. |
| TLocalTimePeriod | TLocalTimePeriod provides direct representation for ranges between two local times. |
| TNthDayOfWeekInMonth | Date Generator for nth day of the week in month. |
| TPartialDate | Date Generator for a partial date. |
| TTime | TTime is the primary interface for time point manipulation. |
| TTimeDuration | Represents a length of time. |
| TTimePeriod | TimePeriod provides direct representation for ranges between two times. |
| TTimeZone | A posix TTimeZone is a set of data and rules that provide information about a time zone. |
| TTZDatabase | The Time Zone Database (#TTZDatabase) is a store of time zone information. |
| TYearBasedGenerator | Date Generator base type for TLastDayOfWeekInMonth, TFirstDayOfWeekInMonth, TNthDayOfWeekInMonth and TPartialDate. |
| Const Apr:Int | |
| Description | Month - April. |
| Const Aug:Int | |
| Description | Month - August. |
| Const Dec:Int | |
| Description | Month - December. |
| Const Feb:Int | |
| Description | Month - February. |
| Const Fifth:Int | |
| Description | Nth Day - Fifth. |
| Const First:Int | |
| Description | Nth Day - First. |
| Const Fourth:Int | |
| Description | Nth Day - Fourth. |
| Const Friday:Int | |
| Description | Week Day - Friday. |
| Const Jan:Int | |
| Description | Month - January. |
| Const Jul:Int | |
| Description | Month - July. |
| Const Jun:Int | |
| Description | Month - June. |
| Const Mar:Int | |
| Description | Month - March. |
| Const May:Int | |
| Description | Month - May. |
| Const Monday:Int | |
| Description | Week Day - Monday. |
| Const Nov:Int | |
| Description | Month - November. |
| Const Oct:Int | |
| Description | Month - October. |
| Const Saturday:Int | |
| Description | Week Day - Saturday. |
| Const Second:Int | |
| Description | Nth Day - Second. |
| Const Sep:Int | |
| Description | Month - September. |
| Const Sunday:Int | |
| Description | Week Day - Sunday. |
| Const Third:Int | |
| Description | Nth Day - Third. |
| Const Thursday:Int | |
| Description | Week Day - Thursday. |
| Const Tuesday:Int | |
| Description | Week Day - Tuesday. |
| Const Wednesday:Int | |
| Description | Week Day - Wednesday. |
| Global defaultDateFacet:TDateFacet | |
| Description | The default date facet. |
| Function DaysBeforeWeekday:Int(date:TDate, WeekDay:Int) | |
| Description | Calculates the number of day from given date to previous given weekday. |
| Information | Valid weekdays include Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (0-6). |
| Function DaysUntilWeekday:Int(date:TDate, WeekDay:Int) | |
| Description | Calculates the number of days from given date until given weekday. |
| Information | Valid weekdays include Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (0-6). |
| Function EndOfMonthDay:Int(year:Int, Month:Int) |
| Function Month:String(Month:Int) | |
| Description | Get the month text for the specified month (1 - 12). |
| Information | This is based on the current month format as specified by TDateFacet. |
| Function NextWeekday:TDate(date:TDate, WeekDay:Int) | |
| Description | Generates a TDate object representing the date of the following weekday from the given date. |
| Information | Valid weekdays include Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (0-6). |
| Function NumFractionalDigits:Int() | |
| Description | Returns the number of fractional digits the time resolution has. |
| Information | 9 for nano, 6 for micro, etc. |
| Function PreviousWeekday:TDate(date:TDate, WeekDay:Int) | |
| Description | Generates a TDate object representing the date of the previous weekday from the given date. |
| Information | Valid weekdays include Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (0-6). |
| Function SetCurrentDateFacet(facet:TDateFacet) | |
| Description | Sets the current date facet. |
| Information | This controls the appearance of date information. |
| Function TDHours:TTimeDuration(amount:Int) | |
| Description | Convenience function for TTimeDuration.Hour(). |
| Function TDMillisecs:TTimeDuration(amount:Int) | |
| Description | Convenience function for TTimeDuration.Millisecond(). |
| Function TDMinutes:TTimeDuration(amount:Int) | |
| Description | Convenience function for TTimeDuration.Minute(). |
| Function TDSeconds:TTimeDuration(amount:Int) | |
| Description | Convenience function for TTimeDuration.Second(). |
| Function TicksPerSecond:Int() | |
| Description | Return the number of ticks in a second. |
| Information | For example, if the duration supports nanoseconds then the returned result will be 1,000,000,000 (1e+9). |
| Function WeekDay:String(WeekDay:Int) | |
| Description | Get the weekday text for the specified weekday (0 - 6). |
| Information | This is based on the current weekday format as specified by TDateFacet. Valid weekdays include Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday (0-6). |
| Type TDate | |
| Description | The primary interface for date programming. |
| Information | In general, the date class is immutable once constructed although it does allow assignment from another date. |
| Methods Summary | |
|---|---|
| add | Return a TDate adding a day offset. |
| day | Returns the day (of the month) part of the date. |
| dayIterator | Returns a TDateDayIterator for this date. |
| dayOfWeek | Get the day of the week. |
| dayOfYear | Get the day of the year. |
| format | Output the date in the specified format. |
| isAfter | Returns true if the date is after when. |
| isBefore | Returns true if the date is before when. |
| isEqual | Returns true if the two dates are equal. |
| lastDayOfMonth | Returns a TDate object set to the last day of the calling objects current month. |
| Month | Returns the month part of the date. |
| monthIterator | Returns a TDateMonthIterator for this date. |
| subtract | Return a TDate by adding a day offset. |
| subtractDate | Returns the number of days difference. |
| toISOExtendedString | To YYYY-MM-DD where all components are integers.s. |
| toISOString | To YYYYMMDD where all components are integers. |
| toSimpleString | To YYYY-mmm-DD string where mmm 3 char month name. |
| toString | To YYYY-mmm-DD string where mmm 3 char month name. |
| WeekDay | Get the weekday as a string. |
| weekNumber | Returns the ISO 8601 week number for the date. |
| year | Returns the year part of the date. |
| yearIterator | Returns a TDateYearIterator for this date. |
| ymd | Populates year, month and day with the date parts. |
| Functions Summary | |
|---|---|
| Create | Creates a new TDate. |
| fromString | From delimited date string where with order year-month-day eg: 2002-1-25. |
| fromUndelimitedString | From iso type date string where with order year-month-day eg: 20020125. |
| localDay | Creates a new TDate for the current local time. |
| universalDay | Creates a new TDate for the current UCT time. |
| Method add:TDate(days:Int) | |
| Description | Return a TDate adding a day offset. |
| Information | SuperStrictExample source |
| Method day:Int() | |
| Description | Returns the day (of the month) part of the date. |
| Information | SuperStrictExample source |
| Method dayIterator:TDateDayIterator(offset:Int = 1) | |
| Description | Returns a TDateDayIterator for this date. |
| Information | offset is the number of days moved in each forward/backward. |
| Method dayOfWeek:Int() | |
| Description | Get the day of the week. |
| Information | Sunday = 0, Monday = 1, etc.
SuperStrictExample source |
| Method dayOfYear:Int() | |
| Description | Get the day of the year. |
| Information | Number from 1 to 366.
SuperStrictExample source |
| Method format:String(f:String) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description | Output the date in the specified format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Information | Formatting characters are as follows :
SuperStrictExample source | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Method isAfter:Int(when:TDate) | |
| Description | Returns true if the date is after when. |
| Method isBefore:Int(when:TDate) | |
| Description | Returns true if the date is before when. |
| Method isEqual:Int(when:TDate) | |
| Description | Returns true if the two dates are equal. |
| Method lastDayOfMonth:TDate() | |
| Description | Returns a TDate object set to the last day of the calling objects current month. |
| Information | SuperStrictExample source |
| Method Month:Int() | |
| Description | Returns the month part of the date. |
| Information | SuperStrictExample source |
| Method monthIterator:TDateMonthIterator(offset:Int = 1) | |
| Description | Returns a TDateMonthIterator for this date. |
| Information | offset is the number of months moved in each forward/backward. |
| Method subtract:TDate(days:Int) | |
| Description | Return a TDate by adding a day offset. |
| Information | SuperStrictExample source |
| Method subtractDate:Int(date:TDate) | |
| Description | Returns the number of days difference. |
| Information | SuperStrictExample source |
| Method toISOExtendedString:String() | |
| Description | To YYYY-MM-DD where all components are integers.s. |
| Method toISOString:String() | |
| Description | To YYYYMMDD where all components are integers. |
| Method toSimpleString:String() | |
| Description | To YYYY-mmm-DD string where mmm 3 char month name. |
| Method toString:String() | |
| Description | To YYYY-mmm-DD string where mmm 3 char month name. |
| Method WeekDay:String() | |
| Description | Get the weekday as a string. |
| Information | This is based on the current weekday format as specified by TDateFacet. |
| Method weekNumber:Int() | |
| Description | Returns the ISO 8601 week number for the date. |
| Information | SuperStrictExample source |
| Method year:Int() | |
| Description | Returns the year part of the date. |
| Information | SuperStrictExample source |
| Method yearIterator:TDateYearIterator(offset:Int = 1) | |
| Description | Returns a TDateYearIterator for this date. |
| Information | offset is the number of years moved in each forward/backward. |
| Method ymd(year:Int Var, Month:Int Var, day:Int Var) | |
| Description | Populates year, month and day with the date parts. |
| Information | SuperStrictExample source |
| Function Create:TDate(year:Int, Month:Int, day:Int) | |
| Description | Creates a new TDate. |
| Information | SuperStrictExample source |
| Function fromString:TDate(date:String) | |
| Returns | A TDate of the string entered, or Null if the date was invalid. |
| Description | From delimited date string where with order year-month-day eg: 2002-1-25. |
| Information | SuperStrictExample source |
| Function fromUndelimitedString:TDate(date:String) | |
| Description | From iso type date string where with order year-month-day eg: 20020125. |
| Information | SuperStrictExample source |
| Function localDay:TDate() | |
| Description | Creates a new TDate for the current local time. |
| Information | SuperStrictExample source |
| Function universalDay:TDate() | |
| Description | Creates a new TDate for the current UCT time. |
| Type TDateDayIterator Extends TDateIterator | |
| Description | A TDateIterator for stepping over days. |
| Functions Summary | |
|---|---|
| CreateIterator | Creates a new TDateDayIterator from date for the step size of offset days. |
| Function CreateIterator:TDateDayIterator(date:TDate, offset:Int = 1) | |
| Description | Creates a new TDateDayIterator from date for the step size of offset days. |
| Type TDateFacet Extends TLocaleFacet | |
| Description | The TDateFacet enables users to have significant control over the output of dates (and other gregorian objects). |
| Methods Summary | |
|---|---|
| format | Set the format for dates. |
| monthFormat | Set the format for months when they are output individually. |
| setISOExtendedFormat | Sets the date format to ISO Extended. |
| setISOFormat | Sets the date format to ISO. |
| setLongMonthNames | Replace strings used when outputting long months. |
| setLongWeekdayNames | Replace strings used when outputting long weekdays. |
| setShortMonthNames | Replace strings used when outputting short months. |
| setShortWeekdayNames | Replace strings used when outputting short weekdays. |
| weekdayFormat | Set the format for weekdays when they are output individually. |
| Functions Summary | |
|---|---|
| Create | Creates a new TDateFacet. |
| Method format(fmt:String) | |
| Description | Set the format for dates. |
| Method monthFormat(fmt:String) | |
| Description | Set the format for months when they are output individually. |
| Method setISOExtendedFormat() | |
| Description | Sets the date format to ISO Extended. |
| Method setISOFormat() | |
| Description | Sets the date format to ISO. |
| Method setLongMonthNames(names:String[]) | |
| Description | Replace strings used when outputting long months. |
| Information | Expected to be non-Null and 12 months. |
| Method setLongWeekdayNames(names:String[]) | |
| Description | Replace strings used when outputting long weekdays. |
| Information | Expected to be non-Null and 7 days, with Sunday starting at 0. |
| Method setShortMonthNames(names:String[]) | |
| Description | Replace strings used when outputting short months. |
| Information | Expected to be non-Null and 12 months. |
| Method setShortWeekdayNames(names:String[]) | |
| Description | Replace strings used when outputting short weekdays. |
| Information | Expected to be non-Null and 7 days, with Sunday starting at 0. |
| Method weekdayFormat(fmt:String) | |
| Description | Set the format for weekdays when they are output individually. |
| Function Create:TDateFacet() | |
| Description | Creates a new TDateFacet. |
| Type TDateIterator Extends TDate Abstract | |
| Description | Base type for date iterators. |
| Information | The methods forward and backward will move along the time-line based on the size of the offset as defined when the iterator is created. See TDateDayIterator, TDateMonthIterator and TDateYearIterator for implementations. |
| Methods Summary | |
|---|---|
| backward | Move date backward one step. |
| forward | Move date forward one step. |
| Method backward() | |
| Description | Move date backward one step. |
| Method forward() | |
| Description | Move date forward one step. |
| Type TDateMonthIterator Extends TDateIterator | |
| Description | A TDateIterator for stepping over months. |
| Functions Summary | |
|---|---|
| CreateIterator | Creates a new TDateMonthIterator from date for the step size of offset months. |
| Function CreateIterator:TDateMonthIterator(date:TDate, offset:Int = 1) | |
| Description | Creates a new TDateMonthIterator from date for the step size of offset months. |
| Type TDatePeriod | |
| Description | TDatePeriod provides direct representation for ranges between two dates. |
| Information | The range is from the begin date up to, but not including, the end date. A period that is created with beginning and end points being equal, or with a duration of zero, is known as a zero length period. Zero length periods are considered invalid (it is perfectly legal to construct an invalid period). For these periods, the last point will always be one unit less that the begin point. |
| Methods Summary | |
|---|---|
| begin | Returns first day of period. |
| contains | True if period is within this period. |
| containsDate | True if date is within the period. |
| intersection | Calculates the intersection of 2 periods. |
| intersects | True if periods overlap. |
| isAdjacent | Checks if two periods are adjacent, but not overlapping. |
| isAfter | Determines if the period is after a given date. |
| isBefore | Determines if the period is before a given date. |
| isEqual | True if periods are the same. |
| isGreater | True if begin greater than period.end. |
| isLess | True if end is less than period.begin. |
| isNull | True if period is not well formed. |
| last | Returns the last date in the period. |
| length | Returns the length (number of days) in the period. |
| merge | Returns union of two periods. |
| periodEnd | Returns one past the last in the period. |
| shift | Add days to both begin and end. |
| span | Combines two periods and any gap between them such that begin = min(begin, period.begin) and end = max(end , period.end) |
| toISOString | |
| toString | To [YYYY-mmm-DD/YYYY-mmm-DD] string where mmm is 3 char month name. |
| Functions Summary | |
|---|---|
| Create | Create a period as [beginDate, endDate]. |
| CreateWithDays | Create a period as [beginDate, beginDate + length] where end point would be beginDate + length. |
| Method begin:TDate() | |
| Description | Returns first day of period. |
| Information | SuperStrictExample source |
| Method contains:Int(period:TDatePeriod) | |
| Description | True if period is within this period. |
| Information | SuperStrictExample source |
| Method containsDate:Int(date:TDate) | |
| Description | True if date is within the period. |
| Information | Zero length periods cannot contain any points.
SuperStrictExample source |
| Method intersection:TDatePeriod(period:TDatePeriod) | |
| Description | Calculates the intersection of 2 periods. |
| Information | Null if no intersection.
SuperStrictExample source |
| Method intersects:Int(period:TDatePeriod) | |
| Description | True if periods overlap. |
| Information | SuperStrictExample source |
| Method isAdjacent:Int(period:TDatePeriod) | |
| Description | Checks if two periods are adjacent, but not overlapping. |
| Information | SuperStrictExample source |
| Method isAfter:Int(date:TDate) | |
| Description | Determines if the period is after a given date. |
| Information | SuperStrictExample source |
| Method isBefore:Int(date:TDate) | |
| Description | Determines if the period is before a given date. |
| Information | SuperStrictExample source |
| Method isEqual:Int(period:TDatePeriod) | |
| Description | True if periods are the same. |
| Method isGreater:Int(period:TDatePeriod) | |
| Description | True if begin greater than period.end. |
| Method isLess:Int(period:TDatePeriod) | |
| Description | True if end is less than period.begin. |
| Method isNull:Int() | |
| Description | True if period is not well formed. |
| Information | eg. end less than or equal to begin.
SuperStrictExample source |
| Method last:TDate() | |
| Description | Returns the last date in the period. |
| Information | SuperStrictExample source |
| Method length:Int() | |
| Description | Returns the length (number of days) in the period. |
| Information | SuperStrictExample source |
| Method merge:TDatePeriod(period:TDatePeriod) | |
| Description | Returns union of two periods. |
| Information | Null if no intersection.
SuperStrictExample source |
| Method periodEnd:TDate() | |
| Description | Returns one past the last in the period. |
| Information | SuperStrictExample source |
| Method shift(days:Int) | |
| Description | Add days to both begin and end. |
| Information | SuperStrictExample source |
| Method span:TDatePeriod(period:TDatePeriod) | |
| Description | Combines two periods and any gap between them such that begin = min(begin, period.begin) and end = max(end , period.end) |
| Information | SuperStrictExample source |
| Method toISOString:String() |
| Method toString:String() | |
| Description | To [YYYY-mmm-DD/YYYY-mmm-DD] string where mmm is 3 char month name. |
| Function Create:TDatePeriod(beginDate:TDate, endDate:TDate) | |
| Description | Create a period as [beginDate, endDate]. |
| Information | If endDate is <= beginDate then the period will be invalid.
SuperStrictExample source |
| Function CreateWithDays:TDatePeriod(beginDate:TDate, length:Int) | |
| Description | Create a period as [beginDate, beginDate + length] where end point would be beginDate + length. |
| Information | If length is <= zero then the period will be defined as invalid.
SuperStrictExample source |
| Type TDateYearIterator Extends TDateIterator | |
| Description | A TDateIterator for stepping over years. |
| Functions Summary | |
|---|---|
| CreateIterator | Creates a new TDateYearIterator from date for the step size of offset years. |
| Function CreateIterator:TDateYearIterator(date:TDate, offset:Int = 1) | |
| Description | Creates a new TDateYearIterator from date for the step size of offset years. |
| Type TFirstDayOfWeekAfter | |
| Description | Date Generator for first day of the week after a date. |
| Information | Calculate something like First Sunday after Jan 1,2002. |
| Methods Summary | |
|---|---|
| getDate | Returns the date for the first day after the specified date. |
| Functions Summary | |
|---|---|
| Create | Creates a new TFirstDayOfWeekAfter for the given weekday. |
| Method getDate:TDate(date:TDate) | |
| Description | Returns the date for the first day after the specified date. |
| Function Create:TFirstDayOfWeekAfter(WeekDay:Int) | |
| Description | Creates a new TFirstDayOfWeekAfter for the given weekday. |
| Information | A weekday may be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday (0-6). |
| Type TFirstDayOfWeekBefore | |
| Description | Date Generator for first day of the week before a date. |
| Information | Calculate something like First Monday before Feb 1,2002. |
| Methods Summary | |
|---|---|
| getDate | Returns the date for the first day before the specified date. |
| Functions Summary | |
|---|---|
| Create | Creates a new TFirstDayOfWeekBefore for the given weekday. |
| Method getDate:TDate(date:TDate) | |
| Description | Returns the date for the first day before the specified date. |
| Function Create:TFirstDayOfWeekBefore(WeekDay:Int) | |
| Description | Creates a new TFirstDayOfWeekBefore for the given weekday. |
| Information | A weekday may be one of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday or Saturday (0-6). |
| Type TFirstDayOfWeekInMonth Extends TYearBasedGenerator | |
| Description | Date Generator for first day of the week in month. |
| Information | See TYearBasedGenerator. |
| Functions Summary | |
|---|---|
| Create | Creates a new TFirstDayOfWeekInMonth for the given weekday and month. |
| Function Create:TFirstDayOfWeekInMonth(WeekDay:Int, Month:Int) | |
| Description | Creates a new TFirstDayOfWeekInMonth for the given weekday and month. |
| Information | A weekday may be one of Sunday, Monday, Tuesday, Wednesday, Thursday,
Friday or Saturday. Month may be one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov or Dec. |
| Type TLastDayOfWeekInMonth Extends TYearBasedGenerator | |
| Description | Date Generator for last day of the week in month. |
| Information | See TYearBasedGenerator. |
| Functions Summary | |
|---|---|
| Create | Creates a new TLastDayOfWeekInMonth for the given weekday and month. |
| Function Create:TLastDayOfWeekInMonth(WeekDay:Int, Month:Int) | |
| Description | Creates a new TLastDayOfWeekInMonth for the given weekday and month. |
| Information | A weekday may be one of Sunday, Monday, Tuesday, Wednesday, Thursday,
Friday or Saturday. Month may be one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov or Dec. |
| Type TLocalDateTime | |
| Description | A TLocalDateTime object is a point in time and an associated time zone. |
| Information | The time is represented internally as UTC. |
| Methods Summary | |
|---|---|
| addDays | Adds days to local date time, returning a new TLocalDateTime. |
| addDuration | Adds duration to the local date time, returning a new TLocalDateTime. |
| addMonths | Adds months to local date time, returning a new TLocalDateTime. |
| addYears | Adds years to local date time, returning a new TLocalDateTime. |
| isDST | Determines if time value is in DST for associated zone. |
| isEqual | True if the two local date times are equal. |
| isGreater | True if this local date time is greater than the parameter. |
| isLess | True if this local date time is less than the parameter. |
| localTime | Returns the local time for this object (Wall-clock). |
| subtractDays | Subtracts days from local date time, returning a new TLocalDateTime. |
| subtractDuration | Subtracts duration from the local date time, returning a new TLocalDateTime. |
| subtractMonths | Subtracts months from local date time, returning a new TLocalDateTime. |
| subtractYears | Subtracts years from local date time, returning a new TLocalDateTime. |
| UTCTime | Converts the local time value to a UTC value. |
| zone | Returns associated TTimeZone object. |
| Functions Summary | |
|---|---|
| CreateFromTime | |
| Method addDays:TLocalDateTime(days:Int) | |
| Description | Adds days to local date time, returning a new TLocalDateTime. |
| Method addDuration:TLocalDateTime(duration:TTimeDuration) | |
| Description | Adds duration to the local date time, returning a new TLocalDateTime. |
| Method addMonths:TLocalDateTime(months:Int) | |
| Description | Adds months to local date time, returning a new TLocalDateTime. |
| Method addYears:TLocalDateTime(years:Int) | |
| Description | Adds years to local date time, returning a new TLocalDateTime. |
| Method isDST:Int() | |
| Description | Determines if time value is in DST for associated zone. |
| Method isEqual:Int(ldt:TLocalDateTime) | |
| Description | True if the two local date times are equal. |
| Method isGreater:Int(ldt:TLocalDateTime) | |
| Description | True if this local date time is greater than the parameter. |
| Method isLess:Int(ldt:TLocalDateTime) | |
| Description | True if this local date time is less than the parameter. |
| Method localTime:TTime() | |
| Description | Returns the local time for this object (Wall-clock). |
| Information | SuperStrictExample source |
| Method subtractDays:TLocalDateTime(days:Int) | |
| Description | Subtracts days from local date time, returning a new TLocalDateTime. |
| Method subtractDuration:TLocalDateTime(duration:TTimeDuration) | |
| Description | Subtracts duration from the local date time, returning a new TLocalDateTime. |
| Method subtractMonths:TLocalDateTime(months:Int) | |
| Description | Subtracts months from local date time, returning a new TLocalDateTime. |
| Method subtractYears:TLocalDateTime(years:Int) | |
| Description | Subtracts years from local date time, returning a new TLocalDateTime. |
| Method UTCTime:TTime() | |
| Description | Converts the local time value to a UTC value. |
| Information | SuperStrictExample source |
| Method zone:TTimeZone() | |
| Description | Returns associated TTimeZone object. |
| Function CreateFromTime:TLocalDateTime(time:TTime, zone:TTimeZone) |
| Type TLocalTimePeriod | |
| Description | TLocalTimePeriod provides direct representation for ranges between two local times. |
| Information | Periods provide the ability to simplify some types of calculations by simplifying the conditional logic of the program. |
| Methods Summary | |
|---|---|
| begin | Return first local date time of the period. |
| contains | True if period is within the period. |
| containsTime | True if time is within the period. |
| intersection | Calculate the intersection of 2 periods. |
| intersects | True if periods overlap. |
| isEqual | True if the two local time periods are equal. |
| isGreater | True if this local time period is greater than the parameter. |
| isLess | True if this local time period is less than the parameter. |
| isNull | True if period is not well formed. |
| last | Return last local date time in the period. |
| length | Return the length of the local time period. |
| merge | Returns union of two periods. |
| periodEnd | Return one past the last in period. |
| shift | Add duration to both begin and end. |
| span | Combines two periods and any gap between them such that begin = min(p1.begin, p2.begin) and end = max(p1.end , p2.end). |
| Functions Summary | |
|---|---|
| Create | Create a period as [begin, end). |
| CreateWithDuration | Create a period as [begin, begin + duration) where end would be begin + duration. |
| Method begin:TLocalDateTime() | |
| Description | Return first local date time of the period. |
| Method contains:Int(period:TLocalTimePeriod) | |
| Description | True if period is within the period. |
| Method containsTime:Int(time:TLocalDateTime) | |
| Description | True if time is within the period. |
| Information | Zero length periods cannot contain any points. |
| Method intersection:TLocalTimePeriod(period:TLocalTimePeriod) | |
| Description | Calculate the intersection of 2 periods. |
| Information | Null if no intersection. |
| Method intersects:Int(period:TLocalTimePeriod) | |
| Description | True if periods overlap. |
| Method isEqual:Int(period:TLocalTimePeriod) | |
| Description | True if the two local time periods are equal. |
| Information | Periods are equal if ltp1.begin = ltp2.begin and ltp1.last = ltp2.last. |
| Method isGreater:Int(period:TLocalTimePeriod) | |
| Description | True if this local time period is greater than the parameter. |
| Method isLess:Int(period:TLocalTimePeriod) | |
| Description | True if this local time period is less than the parameter. |
| Method isNull:Int() | |
| Description | True if period is not well formed. |
| Information | eg. end less than or equal to begin. |
| Method last:TLocalDateTime() | |
| Description | Return last local date time in the period. |
| Method length:TTimeDuration() | |
| Description | Return the length of the local time period. |
| Method merge:TLocalTimePeriod(period:TLocalTimePeriod) | |
| Description | Returns union of two periods. |
| Information | Null if no intersection. |
| Method periodEnd:TLocalDateTime() | |
| Description | Return one past the last in period. |
| Method shift(duration:TTimeDuration) | |
| Description | Add duration to both begin and end. |
| Method span:TLocalTimePeriod(period:TLocalTimePeriod) | |
| Description | Combines two periods and any gap between them such that begin = min(p1.begin, p2.begin) and end = max(p1.end , p2.end). |
| Function Create:TLocalTimePeriod(beginTime:TLocalDateTime, endTime:TLocalDateTime) | |
| Description | Create a period as [begin, end). |
| Information | If end is <= begin then the period will be defined as invalid. |
| Function CreateWithDuration:TLocalTimePeriod(beginTime:TLocalDateTime, duration:TTimeDuration) | |
| Description | Create a period as [begin, begin + duration) where end would be begin + duration. |
| Information | If duration is <= zero then the period will be defined as invalid. |
| Type TNthDayOfWeekInMonth Extends TYearBasedGenerator | |
| Description | Date Generator for nth day of the week in month. |
| Information | Calculate something like first Monday of January, second Tuesday of March, Third Sunday
of December, etc. See TYearBasedGenerator. |
| Functions Summary | |
|---|---|
| Create | Creates a new TNthDayOfWeekInMonth for the given nth, weekday and month. |
| Function Create:TNthDayOfWeekInMonth(nth:Int, WeekDay:Int, Month:Int) | |
| Description | Creates a new TNthDayOfWeekInMonth for the given nth, weekday and month. |
| Information | Nth may be one of First, Second, Third, Fourth, or Fifth (1-5).
A weekday may be one of Sunday, Monday, Tuesday, Wednesday, Thursday,
Friday or Saturday (0-6). Month may be one of Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov or Dec (1-12). |
| Type TPartialDate Extends TYearBasedGenerator | |
| Description | Date Generator for a partial date. |
| Information | See TYearBasedGenerator. |
| Functions Summary | |
|---|---|
| Create | Creates a new TPartialDate for the given day and month. |
| Function Create:TPartialDate(day:Int, Month:Int) | |
| Description | Creates a new TPartialDate for the given day and month. |
| Type TTime | |
| Description | TTime is the primary interface for time point manipulation. |
| Methods Summary | |
|---|---|
| addDays | Adds days to time, returning a new TTime. |
| addDuration | Adds duration to the time, returning a new TTime. |
| date | Get the date part of a time. |
| isEqual | True if the two times are equal. |
| isGreater | True if this time is greater than the parameter. |
| isLess | True if this time is less than the parameter. |
| subtract | Subtracts time from the time, returning a TTimeDuration. |
| subtractDays | Subtracts days from time, returning a new TTime. |
| subtractDuration | Subtracts duration from the time, returning a new TTime. |
| timeOfDay | Get the time offset in the day. |
| toISOExtendedString | Convert to form YYYY-MM-DDTHH:MM:SS,fffffffff where T is the date-time separator. |
| toISOString | Convert to form YYYYMMDDTHHMMSS,fffffffff where T is the date-time separator. |
| toString | To YYYY-mmm-DD HH:MM:SS.fffffffff string where mmm 3 char month name. |
| Functions Summary | |
|---|---|
| Create | Constructs a new TTime from a date and offset. |
| CreateFromFileTime | Converts a FileTime value to a TTime. |
| CreateFromTimeT | Converts a time_t struct to a TTime. |
| CreateLocal | Get the local time, second level resolution, based on the time zone settings of the computer. |
| CreateLocalMS | Get the local time using a sub second resolution clock. |
| CreateUniversal | Get the UTC time. |
| CreateUniversalMS | Get the UTC time using a sub second resolution clock. |
| Method addDays:TTime(days:Int) | |
| Description | Adds days to time, returning a new TTime. |
| Information | SuperStrictExample source |
| Method addDuration:TTime(duration:TTimeDuration) | |
| Description | Adds duration to the time, returning a new TTime. |
| Information | SuperStrictExample source |
| Method date:TDate() | |
| Description | Get the date part of a time. |
| Information | SuperStrictExample source |
| Method isEqual:Int(time:TTime) | |
| Description | True if the two times are equal. |
| Method isGreater:Int(time:TTime) | |
| Description | True if this time is greater than the parameter. |
| Method isLess:Int(time:TTime) | |
| Description | True if this time is less than the parameter. |
| Method subtract:TTimeDuration(time:TTime) | |
| Description | Subtracts time from the time, returning a TTimeDuration. |
| Information | SuperStrictExample source |
| Method subtractDays:TTime(days:Int) | |
| Description | Subtracts days from time, returning a new TTime. |
| Information | SuperStrictExample source |
| Method subtractDuration:TTime(duration:TTimeDuration) | |
| Description | Subtracts duration from the time, returning a new TTime. |
| Information | SuperStrictExample source |
| Method timeOfDay:TTimeDuration() | |
| Description | Get the time offset in the day. |
| Information | SuperStrictExample source |
| Method toISOExtendedString:String() | |
| Description | Convert to form YYYY-MM-DDTHH:MM:SS,fffffffff where T is the date-time separator. |
| Method toISOString:String() | |
| Description | Convert to form YYYYMMDDTHHMMSS,fffffffff where T is the date-time separator. |
| Method toString:String() | |
| Description | To YYYY-mmm-DD HH:MM:SS.fffffffff string where mmm 3 char month name. |
| Information | Fractional seconds only included if non-zero. |
| Function Create:TTime(date:TDate, offset:TTimeDuration = Null) | |
| Description | Constructs a new TTime from a date and offset. |
| Information | SuperStrictExample source |
| Function CreateFromFileTime:TTime(time:Int) | |
| Description | Converts a FileTime value to a TTime. |
| Information | This value is the number of seconds from 1-Jan-1970. FileTime returns the time at UTC, so you will need to apply your local offset to get the correct local system time. |
| Function CreateFromTimeT:TTime(time:Byte Ptr) | |
| Description | Converts a time_t struct to a TTime. |
| Function CreateLocal:TTime() | |
| Description | Get the local time, second level resolution, based on the time zone settings of the computer. |
| Information | SuperStrictExample source |
| Function CreateLocalMS:TTime() | |
| Description | Get the local time using a sub second resolution clock. |
| Information | On Unix systems this is implemented using GetTimeOfDay. On most Win32 platforms it is implemented using ftime. Win32 systems often do not achieve microsecond resolution via this API. If higher resolution is critical to your application test your platform to see the achieved resolution. |
| Function CreateUniversal:TTime() | |
| Description | Get the UTC time. |
| Information | SuperStrictExample source |
| Function CreateUniversalMS:TTime() | |
| Description | Get the UTC time using a sub second resolution clock. |
| Information | On Unix systems this is implemented using GetTimeOfDay. On most Win32 platforms it is implemented using ftime. Win32 systems often do not achieve microsecond resolution via this API. If higher resolution is critical to your application test your platform to see the achieved resolution. |
| Type TTimeDuration | |
| Description | Represents a length of time. |
| Methods Summary | |
|---|---|
| add | Adds duration to this duration, returning the result in a new TTimeDuration. |
| divide | Divides the length of the duration by value. |
| fractionalSeconds | Get the number of fractional seconds. |
| hours | Get the number of normalized hours. |
| invertSign | Generate a new duration with the sign inverted. |
| isEqual | True if the durations are equal. |
| isGreater | True if this duration is greater than the parameter. |
| isLess | True if this duration is less than the parameter. |
| isNegative | True if duration is negative. |
| minutes | Get the number of minutes normalized +/-(0..59). |
| multiply | Multiplies the length of the duration by value. |
| seconds | Get the normalized number of second +/-(0..59). |
| subtract | Subtracts duration from this duration, returning the result in a new TTimeDuration. |
| toISOString | Converts to a string in the form HHMMSS,fffffffff. |
| toString | To HH:MM:SS.fffffffff where fff is fractional seconds that are only included if non-zero. |
| totalMilliseconds | Get the total number of milliseconds truncating any remaining digits. |
| totalSeconds | Get the total number of seconds truncating any fractional seconds. |
| Functions Summary | |
|---|---|
| Create | Creates a new TTimeDuration from the counts. |
| Hour | Creates a new TTimeDuration for the number of hours. |
| Millisecond | Creates a new TTimeDuration for the number of milliseconds. |
| Minute | Creates a new TTimeDuration for the number of minutes. |
| Second | Creates a new TTimeDuration for the number of seconds. |
| Method add:TTimeDuration(duration:TTimeDuration) | |
| Description | Adds duration to this duration, returning the result in a new TTimeDuration. |
| Information | SuperStrictExample source |
| Method divide:TTimeDuration(value:Int) | |
| Description | Divides the length of the duration by value. |
| Information | Discards any remainder.
SuperStrictExample source |
| Method fractionalSeconds:Int() | |
| Description | Get the number of fractional seconds. |
| Method hours:Int() | |
| Description | Get the number of normalized hours. |
| Method invertSign:TTimeDuration() | |
| Description | Generate a new duration with the sign inverted. |
| Information | SuperStrictExample source |
| Method isEqual:Int(duration:TTimeDuration) | |
| Description | True if the durations are equal. |
| Method isGreater:Int(duration:TTimeDuration) | |
| Description | True if this duration is greater than the parameter. |
| Method isLess:Int(duration:TTimeDuration) | |
| Description | True if this duration is less than the parameter. |
| Method isNegative:Int() | |
| Description | True if duration is negative. |
| Method minutes:Int() | |
| Description | Get the number of minutes normalized +/-(0..59). |
| Method multiply:TTimeDuration(value:Int) | |
| Description | Multiplies the length of the duration by value. |
| Information | SuperStrictExample source |
| Method seconds:Int() | |
| Description | Get the normalized number of second +/-(0..59). |
| Method subtract:TTimeDuration(duration:TTimeDuration) | |
| Description | Subtracts duration from this duration, returning the result in a new TTimeDuration. |
| Information | SuperStrictExample source |
| Method toISOString:String() | |
| Description | Converts to a string in the form HHMMSS,fffffffff. |
| Method toString:String() | |
| Description | To HH:MM:SS.fffffffff where fff is fractional seconds that are only included if non-zero. |
| Method totalMilliseconds:Int() | |
| Description | Get the total number of milliseconds truncating any remaining digits. |
| Method totalSeconds:Int() | |
| Description | Get the total number of seconds truncating any fractional seconds. |
| Function Create:TTimeDuration(hours:Int = 0, minutes:Int = 0, seconds:Int = 0, fractions:Int = 0) | |
| Description | Creates a new TTimeDuration from the counts. |
| Information | The fractions parameter is a number of units and is therefore affected by the resolution
the application is compiled with. If the fractions argument exceeds the limit of the compiled
precision, the excess value will be "carried over" into the seconds field. Ths following is a technique using TicksPerSecond for creating a resolution independent fractions count : Local numberOfTenths:Int = 5 ' create a resolution independent count -- divide by 10 since there are 10 tenths in a second. Local count:Int = numberOfTenths * (TicksPerSecond() / 10) |
| Function Hour:TTimeDuration(hours:Int) | |
| Description | Creates a new TTimeDuration for the number of hours. |
| Information | SuperStrictExample source |
| Function Millisecond:TTimeDuration(milliseconds:Int) | |
| Description | Creates a new TTimeDuration for the number of milliseconds. |
| Information | SuperStrictExample source |
| Function Minute:TTimeDuration(minutes:Int) | |
| Description | Creates a new TTimeDuration for the number of minutes. |
| Information | SuperStrictExample source |
| Function Second:TTimeDuration(seconds:Int) | |
| Description | Creates a new TTimeDuration for the number of seconds. |
| Information | SuperStrictExample source |
| Type TTimePeriod | |
| Description | TimePeriod provides direct representation for ranges between two times. |
| Information | Periods provide the ability to simplify some types of calculations by simplifying the
conditional logic of the program. A period that is created with beginning and end points being equal, or with a duration of zero, is known as a zero length period. Zero length periods are considered invalid (it is perfectly legal to construct an invalid period). For these periods, the last point will always be one unit less that the begin point. |
| Methods Summary | |
|---|---|
| begin | Return first time of period. |
| contains | True if time is within the period. |
| containsPeriod | True if period is within the period. |
| intersection | Calculate the intersection of 2 periods. |
| intersects | True if periods overlap. |
| isEqual | True if periods are the same. |
| isGreater | True if begin greater than period.end. |
| isLess | True if end is less than period.begin. |
| isNull | True if period is not well formed. |
| last | Return last time in the period. |
| length | Return the length of the time period. |
| merge | Returns union of two periods. |
| periodEnd | Return one past the last in period. |
| shift | Add duration to both begin and end. |
| span | Combines two periods and any gap between them such that begin = min(p1.begin, p2.begin) and end = max(p1.end , p2.end). |
| toString | To [YYYY-mmm-DD hh:mm:ss.fffffffff/YYYY-mmm-DD hh:mm:ss.fffffffff] string where mmm is 3 char month name. |
| Functions Summary | |
|---|---|
| Create | Create a period as [begin, end). |
| CreateWithDuration | Create a period as [begin, begin + duration) where end would be begin + duration. |
| Method begin:TTime() | |
| Description | Return first time of period. |
| Method contains:Int(time:TTime) | |
| Description | True if time is within the period. |
| Information | Zero length periods cannot contain any points. |
| Method containsPeriod:Int(period:TTimePeriod) | |
| Description | True if period is within the period. |
| Method intersection:TTimePeriod(period:TTimePeriod) | |
| Description | Calculate the intersection of 2 periods. |
| Information | Null if no intersection. |
| Method intersects:Int(period:TTimePeriod) | |
| Description | True if periods overlap. |
| Method isEqual:Int(period:TTimePeriod) | |
| Description | True if periods are the same. |
| Method isGreater:Int(period:TTimePeriod) | |
| Description | True if begin greater than period.end. |
| Method isLess:Int(period:TTimePeriod) | |
| Description | True if end is less than period.begin. |
| Method isNull:Int() | |
| Description | True if period is not well formed. |
| Information | eg. end is less than or equal to begin. |
| Method last:TTime() | |
| Description | Return last time in the period. |
| Method length:TTimeDuration() | |
| Description | Return the length of the time period. |
| Method merge:TTimePeriod(period:TTimePeriod) | |
| Description | Returns union of two periods. |
| Information | Null if no intersection. |
| Method periodEnd:TTime() | |
| Description | Return one past the last in period. |
| Method shift(duration:TTimeDuration) | |
| Description | Add duration to both begin and end. |
| Method span:TTimePeriod(period:TTimePeriod) | |
| Description | Combines two periods and any gap between them such that begin = min(p1.begin, p2.begin) and end = max(p1.end , p2.end). |
| Method toString:String() | |
| Description | To [YYYY-mmm-DD hh:mm:ss.fffffffff/YYYY-mmm-DD hh:mm:ss.fffffffff] string where mmm is 3 char month name. |
| Function Create:TTimePeriod(beginTime:TTime, endTime:TTime) | |
| Description | Create a period as [begin, end). |
| Information | If end is <= begin then the period will be defined as invalid. |
| Function CreateWithDuration:TTimePeriod(beginTime:TTime, duration:TTimeDuration) | |
| Description | Create a period as [begin, begin + duration) where end would be begin + duration. |
| Information | If duration is <= zero then the period will be defined as invalid. |
| Type TTimeZone | |
| Description | A posix TTimeZone is a set of data and rules that provide information about a time zone. |
| Information | Information includes the offset from UTC, its name and abbreviation, as well as daylight
savings rules.
A posix time zone is unique in that the object is created from a Posix time zone string (IEEE Std 1003.1). A POSIX time zone string takes the form of: "std offset dst [offset],start[/time],end[/time]" (with no spaces). 'std' specifies the abbrev of the time zone. 'offset' is the offset from UTC. 'dst' specifies the abbrev of the time zone during daylight savings time. The second offset is how many hours changed during DST. 'start' and 'end' are the dates when DST goes into (and out of) effect. 'offset' takes the form of: [+|-]hh[:mm[:ss]] {h=0-23, m/s=0-59}
'time' and 'offset' take the same form. 'start' and 'end' can be one of three forms:
Mm.w.d {month=1-12, week=1-5 (5 is always last), day=0-6}
Jn {n=1-365 Feb29 is never counted}
n {n=0-365 Feb29 is counted in leap years}
Exceptions will be thrown under the following conditions:
As stated above, the 'offset' and '/time' portions of the string are not required. If they are not given they default to 01:00 for 'offset', and 02:00 for both occurrences of '/time'. Some examples are: "PST-8PDT01:00:00,M4.1.0/02:00:00,M10.1.0/02:00:00" "PST-8PDT,M4.1.0,M10.1.0" These two are actually the same specification (defaults were used in the second string). This zone lies eight hours west of GMT and makes a one hour shift forward during daylight savings time. Daylight savings for this zone starts on the first Sunday of April at 2am, and ends on the first Sunday of October at 2am. "MST-7" This zone is as simple as it gets. This zone lies seven hours west of GMT and has no daylight savings. "EST10EDT,M10.5.0,M3.5.0/03" This string describes the time zone for Sydney Australia. It lies ten hours east of GMT and makes a one hour shift forward during daylight savings. Being located in the southern hemisphere, daylight savings begins on the last Sunday in October at 2am and ends on the last Sunday in March at 3am. "FST+3FDT02:00,J60/00,J304/02" This specification describes a fictitious zone that lies three hours east of GMT. It makes a two hour shift forward for daylight savings which begins on March 1st at midnight, and ends on October 31st at 2am. The 'J' designation in the start/end specs signifies that counting starts at one and February 29th is never counted. "FST+3FDT,59,304" This specification is significant because of the '59'. The lack of 'J' for the start and end dates, indicates that the Julian day-count begins at zero and ends at 365. If you do the math, you'll see that allows for a total of 366 days. This is fine in leap years, but in non-leap years '59' (Feb-29) does not exist. This will construct a valid posix_time_zone object but an exception will be thrown if the date of '59' is accessed in a non-leap year. Ex: posix_time_zone leap_day(std::string("FST+3FDT,59,304"));
leap_day.dst_local_start_time(2004); // ok
leap_day.dst_local_start_time(2003); // Exception thrown
|
| Methods Summary | |
|---|---|
| baseUTCOffset | The amount of time offset from UTC (typically in hours). |
| DSTLocalEndTime | The date and time daylight savings time ends in given year. |
| DSTLocalStartTime | The date and time daylight savings time begins in given year. |
| DSTOffset | The amount of time shifted during daylight savings. |
| DSTZoneAbbrev | Returns the daylight savings abbreviation for the represented time zone. |
| DSTZoneName | Returns the daylight savings name for the represented time zone. |
| hasDST | Returns True if this time zone makes a daylight savings shift. |
| STDZoneAbbrev | Returns the standard abbreviation for the represented time zone. |
| STDZoneName | Returns the standard name for the represented time zone. |
| toString | Returns a posix time zone string representation of this time zone object. |
| Functions Summary | |
|---|---|
| Create | |
| Method baseUTCOffset:TTimeDuration() | |
| Description | The amount of time offset from UTC (typically in hours). |
| Method DSTLocalEndTime:TTime(year:Int) | |
| Description | The date and time daylight savings time ends in given year. |
| Method DSTLocalStartTime:TTime(year:Int) | |
| Description | The date and time daylight savings time begins in given year. |
| Method DSTOffset:TTimeDuration() | |
| Description | The amount of time shifted during daylight savings. |
| Method DSTZoneAbbrev:String() | |
| Description | Returns the daylight savings abbreviation for the represented time zone. |
| Method DSTZoneName:String() | |
| Description | Returns the daylight savings name for the represented time zone. |
| Method hasDST:Int() | |
| Description | Returns True if this time zone makes a daylight savings shift. |
| Method STDZoneAbbrev:String() | |
| Description | Returns the standard abbreviation for the represented time zone. |
| Method STDZoneName:String() | |
| Description | Returns the standard name for the represented time zone. |
| Method toString:String() | |
| Description | Returns a posix time zone string representation of this time zone object. |
| Function Create:TTimeZone(description:String) |
| Type TTZDatabase | |
| Description | The Time Zone Database (#TTZDatabase) is a store of time zone information. |
| Information | The specifications for many time zones (377 at this time) are provided. These specifications are based on data found in the zoneinfo database. The specifications are stored in the file: data/date_time_zonespec.csv |
| Methods Summary | |
|---|---|
| addRecord | Adds a time zone, to the database. |
| timeZoneFromRegion | Returns a time zone that matches the region listed in the data file. |
| Functions Summary | |
|---|---|
| Create | Creates an empty TTZDatabase. |
| LoadFromFile | Creates and populates a TTZDatabase with time zone records found in the zone spec file. |
| Method addRecord(id:String, zone:TTimeZone) | |
| Description | Adds a time zone, to the database. |
| Information | id is the region name for this zone (e.g. "America/Phoenix"). |
| Method timeZoneFromRegion:TTimeZone(id:String) | |
| Returns | a TTimeZone or Null if not found. |
| Description | Returns a time zone that matches the region listed in the data file. |
| Function Create:TTZDatabase() | |
| Description | Creates an empty TTZDatabase. |
| Function LoadFromFile:TTZDatabase(filename:String) | |
| Description | Creates and populates a TTZDatabase with time zone records found in the zone spec file. |
| Type TYearBasedGenerator Abstract | |
| Description | Date Generator base type for TLastDayOfWeekInMonth, TFirstDayOfWeekInMonth, TNthDayOfWeekInMonth and TPartialDate. |
| Methods Summary | |
|---|---|
| getDate | Returns the date for the specified year. |
| Method getDate:TDate(year:Int) Abstract | |
| Description | Returns the date for the specified year. |
| Version | 1.00 |
|---|---|
| License | BSD |
| Copyright | Wrapper - 2007 Bruce A Henderson |
| Modserver | BRL |
| History | 1.00 |
| History | Initial Release. |
| CC_OPTS | -fexceptions |