[operations] [attributes] [fields] [template] [definition]
[implementation] [documentation]
To use the search tool you need to use a browser which supports JAVA (c)

[next] [prev] [superclass] [next peer] [prev peer] [subclass] [index] [hierarchy]

DateTime

inherits from Object

Object <- DateTime



Operations

Get list of all operations

CompareDateTime
DateAsTextWithFormat
DayOfWeekToWeekDisplayIndex
DaysInMonth
DifferentTimes
LocalDate
LocalDateAndTime
LocalTime
MonthsInYear
PackDate
PackTime
SetLocalDate
SetLocalDateAndTime
SetLocalTime
TextToTime
TextToTimeRange
TimeAsTextWithFormat
TimeRangeIndexToDate
UniversalDate
UniversalTime
UnpackDate
UnpackTime
WeekDisplayIndexToDayOfWeek


Attributes

Get list of all attributes

Class DateTime defines no new attributes.


Fields

No fields are defined by DateTime or any of its superclasses.


Instance template

instance DateTime tag;
end instance;

Class definition

Define Class DateTime;
    inherits from Object;

    // basic operations
    
    intrinsic CompareDateTime(date1: Signed; time1: Unsigned; date2: Signed; time2: Unsigned): Signed;
        // compares the two date/time pairs, returns -1, 0, or 1
    intrinsic LocalDate(): Signed, safe;
        // returns the current local date
    intrinsic LocalDateAndTime(var date: Signed; var time: Unsigned);
        // returns the current local date and time
    intrinsic LocalTime(): Unsigned, safe;
        // returns the current local time
    intrinsic SetLocalDate(newDate: Signed);
        // set the system's local date without affecting the local time
    intrinsic SetLocalDateAndTime(date: Signed; time: Unsigned);
        // set the system's local date and time
    intrinsic SetLocalTime(newTime: Unsigned);
        // set the system's local time
    intrinsic UniversalDate(): Signed, safe;
        // get the current Universal Date (Greenwich Mean Time)
    intrinsic UniversalTime(): Unsigned, safe;
        // get the current Universal Time (Greenwich Mean Time)

    // operations that depend on the time measurement system
    // the current API assumes that all locales measure time within a day the same way

    intrinsic DifferentTimes(time1: Unsigned; time2: Unsigned; units: Unsigned): Boolean;
        // true iff the unpacked versions of time1 and time2 differ in the specified unit or a larger unit
        // units are kMillisecond, kSecond, kMinute, kHour
    intrinsic PackTime(array: TimeIntegers): Unsigned;
        // interprets the time array and converts it into a time value
    intrinsic UnpackTime(timeValue: Unsigned; var array: TimeIntegers);
        // converts the time value into a time array

    // operations interpreted according to the default calendar
    // ??? The following assumes that all commonly used calendars switch dates
    // at midnight, which may not be true
    
    intrinsic DaysInMonth(month: Unsigned; year: Unsigned): UnsignedShort;
        // returns the number of days in the specified month of the default calendar
    intrinsic MonthsInYear(year: Unsigned): UnsignedShort;
        // returns the number of months in the specified year of the default calendar
    intrinsic PackDate(array: DateIntegers): Signed;
        // interprets the date array according to the default calendar and converts it into a date value
    intrinsic TimeRangeIndexToDate(timeRangeIndex: Unsigned): Signed;
        // returns date value for day in the past, with the pastness specified by timeRangeIndex:
        // 1 - a day, 2 - 3 days, 3 - a week, 4 - 2 weeks, 5 - a month, 6 - 3 months,
        // 7 - 6 months, 8 - a year.
    intrinsic UnpackDate(dateValue: Signed; var array: DateIntegers);
        // converts the date value into a date array according to the default calendar
    
    // localizable date and time formatting operations
    // ??? how about combined date/time?
    // ??? how do clients that let user enter dates find out about format?

    intrinsic DateAsTextWithFormat(days: Signed; flags: Unsigned): Text;
        // produce a text object representing the specified date in the local format
        // and according to the calendar it relies on
        // flag values are defined in DateTime.h
    intrinsic TimeAsTextWithFormat(milliseconds: Unsigned; flags: Unsigned): Text;
        // produce a text object representing the specified time in the local format
        // flag values are defined in DateTime.h
    
    intrinsic TextToTime(text: HasText; var time: Unsigned;
            var charactersUsed: Unsigned): UnsignedShort;
        // scans beginning of timeText into time; returns 0 if can't parse, 1 if result AM/PM ambiguous, 2 otherwise
        // returns number of characters consumed in charactersUsed (pass nil if not interested)
    intrinsic TextToTimeRange(text: HasText; var startTime: Unsigned; var endTime: Unsigned;
            var charactersUsed: Unsigned): Boolean;
        // scans beginning of timeText into start and end time; returns false if can't scan; tries hard to make end after start
        // returns number of characters consumed in charactersUsed (pass nil if not interested)
    
    intrinsic DayOfWeekToWeekDisplayIndex(dayOfWeek: UnsignedShort): Unsigned;
        // converts day of week (1 = Sunday etc.) to 0-based index that can be used to display a week appropriately for locale
    intrinsic WeekDisplayIndexToDayOfWeek(displayIndex: Unsigned): UnsignedShort;
        // converts 0-based display index to day of week (1 = Sunday) assuming a localized week display

end class;