Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: agmdate.h
Link against: agnmodel.lib

Class AgnDateTime

AgnDateTime

Support

Supported from 5.0

Description

Provides static functions for converting dates and times between formats and for retrieving the minimum and maximum dates in the agenda model's valid date range (from 1st January 1980 to 31st December 2100).

Defined in AgnDateTime:
AddTo(), AgnDateTimeToTTime(), AgnDateToTDateTime(), AgnDateToTTime(), AgnDateToTTimeIntervalDaysFrom0AD(), DayNoInWeek(), IsLessThan(), MaxDate(), MaxDateAsTTime(), MaxDateAsTTimeIntervalDaysFrom0AD(), MaxTime(), MinDate(), MinDateAsTTime(), MinDateAsTTimeIntervalDaysFrom0AD(), MonthsFrom(), NullDate(), NullTime(), TDateTimeToAgnDate(), TTimeIntervalDaysFrom0ADToAgnDate(), TTimeToAgnDate(), TTimeToAgnDateTime(), YearsFrom()


Date/time modification


AddTo()

static void AddTo(TDateTime& aDate, TTimeIntervalYears aYears);
static void AddTo(TDateTime& aDate, TTimeIntervalMonths aMonths);

Description

Adds a time interval to a date/time — overloaded function. The time interval may be a number of years or months, depending on the overload chosen.

Parameters

TDateTime& aDate

Reference to a date/time. On return, the date is modified and all time components are set to zero.

TTimeIntervalYears aYears

The number of years to add to the date/time.

TTimeIntervalMonths aMonths

The number of months to add to the date/time.

[Top]


Date/time conversion


AgnDateTimeToTTime()

static TTime AgnDateTimeToTTime(TAgnDateTime aDateTime);

Description

Converts an agenda date/time to a TTime.

Parameters

TAgnDateTime aDateTime

The agenda date/time to convert. The time component must not be NULL, or a panic is raised.

Return value

TTime

The converted time.


TTimeToAgnDateTime()

static TAgnDateTime TTimeToAgnDateTime(const TTime& aDateTime);

Description

Converts a TTime into an agenda date/time.

Parameters

const TTime& aDateTime

The time to convert.

Return value

TAgnDateTime

The converted agenda date/time.


AgnDateToTDateTime()

static TDateTime AgnDateToTDateTime(TAgnDate aDate);

Description

Converts an agenda date to a TDateTime.

Parameters

TAgnDate aDate

The agenda date to convert.

Return value

TDateTime

The converted date. The time components are all set to zero.


TDateTimeToAgnDate()

static TInt TDateTimeToAgnDate(const TDateTime& aDate)

Description

Converts a TDateTime to an agenda date.

Note

The return value is a TInt rather than a TAgnDate because aDate may specify a date which is outside the valid range for TAgnDates, e.g. if aDate is before 1st January 1980, the return value will be negative.

Parameters

const TDateTime& aDate

The date/time to convert.

Return value

TInt

A number of days since the start of the valid date range for agenda entries.


AgnDateToTTime()

static TTime AgnDateToTTime(TAgnDate aDate);

Description

Converts an agenda date to a TTime. The function raises a panic if aDate is outside the valid range for a TAgnDate.

Parameters

TAgnDate aDate

A valid agenda date.

Return value

TTime

The date converted to a TTime.


TTimeToAgnDate()

static TAgnDate TTimeToAgnDate(const TTime& aDate);

Description

Converts the date portion of a TTime to an agenda date. The time portion is ignored. The resulting agenda date must be within the valid range, or a panic is raised.

Parameters

const TTime& aDate

The time to convert into an agenda date.

Return value

TAgnDate

The converted agenda date.


AgnDateToTTimeIntervalDaysFrom0AD()

static TTimeIntervalDays AgnDateToTTimeIntervalDaysFrom0AD(TAgnDate aDate);

Description

Converts an agenda date to a number of days from 0 AD nominal Gregorian.

Parameters

TAgnDate aDate

The date to convert. Must be within the agenda model's valid range or a panic is raised.

Return value

TTimeIntervalDays

The number of days between 0 AD nominal Gregorian and the date specified.


TTimeIntervalDaysFrom0ADToAgnDate()

static TAgnDate TTimeIntervalDaysFrom0ADToAgnDate(TTimeIntervalDays aDays);

Description

Converts a number of days from 0 AD nominal Gregorian into an agenda date.

Parameters

TTimeIntervalDays

A number of days from 0 AD nominal Gregorian to convert. Must be within the valid range for agenda model dates, or a panic is raised.

Return value

TAgnDate

The converted agenda date.


DayNoInWeek()

static TDay DayNoInWeek(TAgnDate aDate);

Description

Retrieves the day number within the week for an agenda date.

Parameters

TAgnDate aDate

The agenda date.

Return value

TDay

The day number within the week of the date.

[Top]


Date enquiry


IsLessThan()

static TBool IsLessThan(const TDateTime& aDateLeft, const TDateTime& aDateRight);

Description

Tests whether the first TDateTime instance is earlier than the second.

Parameters

const TDateTime& aDateLeft

First date/time to test.

const TDateTime& aDateRight

Second date/time to test.

Return value

TBool

True if the first date/time specified is earlier than the second. False if it is more recent, or they are the same.


MonthsFrom()

static TTimeIntervalMonths MonthsFrom(const TDateTime& aStartDate, const TDateTime& aEndDate);

Description

Calculates the number of whole months between two date/times.

Parameters

const TDateTime& aStartDate

The date to start calculating from.

const TDateTime& aEndDate

The date to calculate to.

Return value

TTimeIntervalMonths

The number of whole months between the two date/times.


YearsFrom()

static TTimeIntervalYears YearsFrom(const TDateTime& aStartDate, const TDateTime& aEndDate);

Description

Calculates the number of whole years between two date/times.

Parameters

const TDateTime& aStartDate

The date to start calculating from.

const TDateTime& aEndDate

The date to calculate to.

Return value

TTimeIntervalYears

The number of whole years between the two date/times.

[Top]


Maximum and minimum


MaxDateAsTTime()

static TTime MaxDateAsTTime();

Description

Gets the maximum date/time allowed for agenda entries as a TTime. This value marks the end of the agenda model's valid date range.

Return value

TTime

The agenda model's maximum date/time.


MinDateAsTTime()

static TTime MinDateAsTTime();

Description

Gets the minimum date/time allowed for agenda entries as a TTime. This value marks the start of the agenda model's valid date range.

Return value

TTime

The agenda model's minimum date/time.


MaxDateAsTTimeIntervalDaysFrom0AD()

static TTimeIntervalDays MaxDateAsTTimeIntervalDaysFrom0AD();

Description

Gets the maximum date allowed for agenda entries as a time interval in days from 0 AD nominal Gregorian.

Return value

TTimeIntervalDays

The number of days between 0 AD nominal Gregorian and the agenda model's maximum date.


MinDateAsTTimeIntervalDaysFrom0AD()

static TTimeIntervalDays MinDateAsTTimeIntervalDaysFrom0AD();

Description

Gets the minimum date allowed for agenda entries as a time interval in days from 0 AD nominal Gregorian.

Return value

TTimeIntervalDays

The number of days between 0 AD nominal Gregorian and the agenda model's minimum date.


MaxDate()

static TAgnDate MaxDate();

Description

Gets the maximum date value allowed for TAgnDates. This date marks the end of the agenda model's valid date range.

Return value

TAgnDate

The agenda model's maximum date value.


MinDate()

static TAgnDate MinDate();

Description

Gets the minimum date value allowed for TAgnDates. This date marks the start of the agenda model's valid date range.

Return value

TAgnDate

The agenda model's minimum date value.


MaxTime()

static TUint MaxTime();

Description

Gets the maximum time value for an agenda entry as a number of minutes from midnight.

Return value

TUint

Maximum time for an agenda entry (= 1439 minutes).


NullDate()

static TAgnDate NullDate();

Description

Gets a NULL date. This is used in the agenda model to indicate a date value which has not been set or which does not apply.

Return value

TAgnDate

A NULL date.


NullTime()

static TAgnTime NullTime();

Description

Gets a NULL time. This is used in the agenda model to indicate a time value which has not been set or which does not apply.

Return value

TAgnTime

A NULL time.