Open CASCADE Technology 7.8.0
|
This class provides services to manage date information. A date represents the following time intervals: year, month, day, hour, minute, second, millisecond and microsecond. Current time is expressed in elapsed seconds and microseconds beginning from 00:00 GMT, January 1, 1979 (zero hour). The valid date can only be later than this one. Note: a Period object gives the interval between two dates. More...
#include <Quantity_Date.hxx>
Public Member Functions | |
Quantity_Date () | |
Constructs a default date (00:00 GMT, January 1, 1979 (zero hour)); use the function SetValues to define the required date; or. | |
Quantity_Date (const Standard_Integer mm, const Standard_Integer dd, const Standard_Integer yyyy, const Standard_Integer hh, const Standard_Integer mn, const Standard_Integer ss, const Standard_Integer mis=0, const Standard_Integer mics=0) | |
Constructs a date from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0).. With: 1 <= mm <= 12 1 <= dd <= max number of days of <mm> 1979 <= yyyy 0 <= hh <= 23 0 <= mn <= 59 0 <= ss <= 59 0 <= mis <= 999 0 <= mics <= 999 Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not the components of the valid date. | |
void | Values (Standard_Integer &mm, Standard_Integer &dd, Standard_Integer &yy, Standard_Integer &hh, Standard_Integer &mn, Standard_Integer &ss, Standard_Integer &mis, Standard_Integer &mics) const |
Gets a complete Date. | |
void | SetValues (const Standard_Integer mm, const Standard_Integer dd, const Standard_Integer yy, const Standard_Integer hh, const Standard_Integer mn, const Standard_Integer ss, const Standard_Integer mis=0, const Standard_Integer mics=0) |
Assigns to this date the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0). Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not components of a valid date. | |
Quantity_Period | Difference (const Quantity_Date &anOther) |
Subtracts one Date from another one to find the period between and returns the value. The result is the absolute value between the difference of two dates. | |
Quantity_Date | Subtract (const Quantity_Period &aPeriod) |
Subtracts a period from a Date and returns the new Date. Raises an exception if the result date is anterior to Jan 1, 1979. | |
Quantity_Date | operator- (const Quantity_Period &aPeriod) |
Quantity_Date | Add (const Quantity_Period &aPeriod) |
Adds a Period to a Date and returns the new Date. | |
Quantity_Date | operator+ (const Quantity_Period &aPeriod) |
Standard_Integer | Year () |
Returns year of a Date. | |
Standard_Integer | Month () |
Returns month of a Date. | |
Standard_Integer | Day () |
Returns Day of a Date. | |
Standard_Integer | Hour () |
Returns Hour of a Date. | |
Standard_Integer | Minute () |
Returns minute of a Date. | |
Standard_Integer | Second () |
Returns seconde of a Date. | |
Standard_Integer | MilliSecond () |
Returns millisecond of a Date. | |
Standard_Integer | MicroSecond () |
Returns microsecond of a Date. | |
Standard_Boolean | IsEqual (const Quantity_Date &anOther) const |
Returns TRUE if both <me> and <other> are equal. This method is an alias of operator ==. | |
Standard_Boolean | operator== (const Quantity_Date &anOther) const |
Standard_Boolean | IsEarlier (const Quantity_Date &anOther) const |
Returns TRUE if <me> is earlier than <other>. | |
Standard_Boolean | operator< (const Quantity_Date &anOther) const |
Standard_Boolean | IsLater (const Quantity_Date &anOther) const |
Returns TRUE if <me> is later then <other>. | |
Standard_Boolean | operator> (const Quantity_Date &anOther) const |
Static Public Member Functions | |
static Standard_Boolean | IsValid (const Standard_Integer mm, const Standard_Integer dd, const Standard_Integer yy, const Standard_Integer hh, const Standard_Integer mn, const Standard_Integer ss, const Standard_Integer mis=0, const Standard_Integer mics=0) |
Checks the validity of a date - returns true if a date defined from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0) is valid. A date must satisfy the conditions above: | |
static Standard_Boolean | IsLeap (const Standard_Integer yy) |
Returns true if a year is a leap year. The leap years are divisible by 4 and not by 100 except the years divisible by 400. | |
This class provides services to manage date information. A date represents the following time intervals: year, month, day, hour, minute, second, millisecond and microsecond. Current time is expressed in elapsed seconds and microseconds beginning from 00:00 GMT, January 1, 1979 (zero hour). The valid date can only be later than this one. Note: a Period object gives the interval between two dates.
Quantity_Date::Quantity_Date | ( | ) |
Constructs a default date (00:00 GMT, January 1, 1979 (zero hour)); use the function SetValues to define the required date; or.
Quantity_Date::Quantity_Date | ( | const Standard_Integer | mm, |
const Standard_Integer | dd, | ||
const Standard_Integer | yyyy, | ||
const Standard_Integer | hh, | ||
const Standard_Integer | mn, | ||
const Standard_Integer | ss, | ||
const Standard_Integer | mis = 0 , |
||
const Standard_Integer | mics = 0 |
||
) |
Constructs a date from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0).. With: 1 <= mm <= 12 1 <= dd <= max number of days of <mm> 1979 <= yyyy 0 <= hh <= 23 0 <= mn <= 59 0 <= ss <= 59 0 <= mis <= 999 0 <= mics <= 999 Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not the components of the valid date.
Quantity_Date Quantity_Date::Add | ( | const Quantity_Period & | aPeriod | ) |
Adds a Period to a Date and returns the new Date.
Standard_Integer Quantity_Date::Day | ( | ) |
Returns Day of a Date.
Quantity_Period Quantity_Date::Difference | ( | const Quantity_Date & | anOther | ) |
Subtracts one Date from another one to find the period between and returns the value. The result is the absolute value between the difference of two dates.
Standard_Integer Quantity_Date::Hour | ( | ) |
Returns Hour of a Date.
Standard_Boolean Quantity_Date::IsEarlier | ( | const Quantity_Date & | anOther | ) | const |
Returns TRUE if <me> is earlier than <other>.
Standard_Boolean Quantity_Date::IsEqual | ( | const Quantity_Date & | anOther | ) | const |
Returns TRUE if both <me> and <other> are equal. This method is an alias of operator ==.
Standard_Boolean Quantity_Date::IsLater | ( | const Quantity_Date & | anOther | ) | const |
Returns TRUE if <me> is later then <other>.
|
inlinestatic |
Returns true if a year is a leap year. The leap years are divisible by 4 and not by 100 except the years divisible by 400.
|
static |
Checks the validity of a date - returns true if a date defined from the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0) is valid. A date must satisfy the conditions above:
Standard_Integer Quantity_Date::MicroSecond | ( | ) |
Returns microsecond of a Date.
Standard_Integer Quantity_Date::MilliSecond | ( | ) |
Returns millisecond of a Date.
Standard_Integer Quantity_Date::Minute | ( | ) |
Returns minute of a Date.
Standard_Integer Quantity_Date::Month | ( | ) |
Returns month of a Date.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Standard_Integer Quantity_Date::Second | ( | ) |
Returns seconde of a Date.
void Quantity_Date::SetValues | ( | const Standard_Integer | mm, |
const Standard_Integer | dd, | ||
const Standard_Integer | yy, | ||
const Standard_Integer | hh, | ||
const Standard_Integer | mn, | ||
const Standard_Integer | ss, | ||
const Standard_Integer | mis = 0 , |
||
const Standard_Integer | mics = 0 |
||
) |
Assigns to this date the year yyyy, the month mm, the day dd, the hour hh, the minute mn, the second ss, the millisecond mis (defaulted to 0) and the microsecond mics (defaulted to 0). Exceptions Quantity_DateDefinitionError if mm, dd, hh, mn, ss, mis and mics are not components of a valid date.
Quantity_Date Quantity_Date::Subtract | ( | const Quantity_Period & | aPeriod | ) |
Subtracts a period from a Date and returns the new Date. Raises an exception if the result date is anterior to Jan 1, 1979.
void Quantity_Date::Values | ( | Standard_Integer & | mm, |
Standard_Integer & | dd, | ||
Standard_Integer & | yy, | ||
Standard_Integer & | hh, | ||
Standard_Integer & | mn, | ||
Standard_Integer & | ss, | ||
Standard_Integer & | mis, | ||
Standard_Integer & | mics | ||
) | const |
Gets a complete Date.
Standard_Integer Quantity_Date::Year | ( | ) |
Returns year of a Date.