⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zdate.man

📁 C语言库函数的源代码,是C语言学习参考的好文档。
💻 MAN
📖 第 1 页 / 共 3 页
字号:

     Syntax           zDate EndDST() const;
               static zDate EndDST(int aYear);

     Remarks   This function is similar to BeginDST() except it returns the
               date when the Daylight Savings Time stops being in effect.
               The default uses the American convention of ending DST at
               2:00am on the last Sunday of October. This behavior can be
               modified to suit your specific locale.

     Return    A zDate object with the correct date.

     See also  zDate::IsDST(); zDate::SetEndDST(); zDate::BeginDST();

     Example   assert(zDate(zDate::oct,27,1996) == zDate::EndDST(1996));


   ZDATE::ISDST
   --------------------------------------------------------------------------
     Synopsis  Checks if a date falls in the Daylight Savings Time range.

     Syntax           Boolean IsDST() const;
               static Boolean IsDST(const zDate &aDate);

     Remarks   This function checks if a date happens to be in the period
               during which Daylight Savings Time is in effect. The default
               uses the US convention which begins DST on the first Sunday of
               April and ends it on the last Sunday of October. You can
               modify the time span of the DST period with the SetBeginDST()
               and SetEndDST() functions. The second version is more generic
               and will check any date object (the first one is intended to
               be called via an object to check itself).

     Return    True, if the date falls in the DST period range;
               False, otherwise.

     See also  zDate::SetBeginDST(); zDate::SetEndDST)();

     Example   assert( zDate(zDate::jul, 16, 1996).IsDST() );


   ZDATE::ISLEAPYEAR
   --------------------------------------------------------------------------
     Synopsis  Checks if a specific year is leap.

     Syntax           Boolean IsLeapYear() const;
               static Boolean IsLeapYear(int aYear);

     Remarks   This routine checks if a year is leap or not. Leap years are
               defined as follows: before the Gregorian reform, any year
               divisible by 4 is a leap year. After the reform, all years
               divisible by 4 are leap years unless they are also divisible
               by 100 and not divisible by 400 (that means that 1500 was not
               a leap year but 1600 was). The second version can be called
               without a zDate object to check any year.

     Return    True if the year is leap; False otherwise.

     See also  zDate::DayNumber();

     Example   assert(True == zDate::IsLeapYear(1600));
               assert(False == zDate(zDate::jan,1,1500).IsLeapYear());


   ZDATE::ISVALID
   --------------------------------------------------------------------------
     Synopsis  Checks if a date is valid.

     Syntax           Boolean IsValid() const;
               static Boolean IsValid(month Month, int Day, int Year);

     Remarks   Checks if all the fields of a particular date are valid. Note
               that this function is not called within the class member
               routines. They all assume they are dealing with valid dates.
               It is your responsibility to ensure that. A valid date is any
               date after January 1, 0001 (with the exception of the days
               between October 4 and 15, 1582). Also checked are the day of
               month (this has to be correct for the current month). Note
               that you can use the second version without an actual zDate
               object to check any date.

     Return    True if the date is valid, False otherwise.

     See also  n/a

     Example   assert( !zDate(zDate::feb, 31, 1996).IsValid );


   ZDATE::MONTH
   --------------------------------------------------------------------------
     Synopsis  Returns the month of the date object.

     Syntax    zDate::month Month() const;

     Remarks   This routine returns the month of the current date object.
               The return value can be examined via the zDate::month
               enumeration constants. You will need to use the scope
               resolution operator to access those.

     Return    The month of the year.

     See also  zDate::Year(); zDate::Day();

     Example   switch( zDate::Today().Month() ){
                   case zDate::jul:
                       cout << "This is my month!";
                       break;
                    default:
                       cout << "Just another month";
                       break
               }


   ZDATE::MOONPHASE
   --------------------------------------------------------------------------
     Synopsis  Determines the phase of the moon.

     Syntax           zDate::moon_phase MoonPhase() const;
               static zDate::moon_phase MoonPhase(const zDate &aDate);

     Remarks   This routine determines the phase of the moon for a given
               date. You need to use the supplied enumeration constants
               'moon_phase' to interpret the result. The Moon moves through
               8 phases on its way around the earth during the Moon cycle
               which lasts about 30 days. Whenever the moon is between the
               Earth and the Sun, we have a new moon (i.e. the Moon is not
               visible in the sky). Then the Moon's visible surface starts
               increasing and it moves through the waxing crescent, first
               quarter, and waxing gibbous stages to the full moon position
               (when the Earth is between the Moon and the Sun). From that
               point on, the visible surface of the Moon decreases going
               from waning gibbous, through the third quarter, and to a
               waning crescent. Then the cycle repeats. You can use the
               second version of the function to calculate the moon phase
               for any date object.

     Return    The phase of the Moon.

     See also  zDate::moon_phase

     Example   zDate fullMoon(zDate::sep, 26, 1996);
               assert( zDate::full_moon == fullMoon.MoonPhase() );


   ZDATE::OPERATOR LONG
   --------------------------------------------------------------------------
     Synopsis  Type cast of a zDate to a long integer, return the day number.

     Syntax    operator long() const;

     Remarks   This operator is useful for a type cast in situations where
               you need a long number representation of the date. The same
               effect can be achieved with the DayNumber() functions as the
               results are identical. This may be a cleaner solution for some
               situations (like passing the day number to a function which
               expects a long, in which case you can specify the zDate
               object as a parameter and the cast will be performed
               automatically).

     Return    The day number from January 1, 0001 A.D.

     See also  zDate::DayNumber();

     Example   // this is a contrived example which forces the use
               // of the zDate(ulong nDayNumber) constructor instead
               // of the copy constructor. Generally, you don't want
               // to do this, as the latter is a lot faster!
               ZDate date( (long)zDate::Today() );


   ZDATE::OPERATOR!=
   --------------------------------------------------------------------------
     Synopsis  Tests two dates for inequality.

     Syntax    Boolean operator!=(const zDate &aDate) const;

     Remarks   This operator allows intuitive test for date inequality.
               You can test if two dates are different using the regular
               C++ notation.

     Return    True if dates are different, False if they are the same.

     See also  zDate::operator==();

     Example   zDate first(zDate::jul, 16, 1973);
               zDate second = zDate::Today();
               assert( first != second );


   ZDATE::OPERATOR+
   --------------------------------------------------------------------------
     Synopsis  Adds or subtracts a number of days from a date object.

     Syntax    zDate operator+(int nDays) const;
               zDate operator+(long nDays) const;

     Remarks   This operator allows adding a number of days to a date object
               or subtracting (if the 'nDays' parameter is negative) a
               certain amount of days. Care should be taken that the
               resulting year does not fall below 1 A.D. The current date
               object is not modified, which is what is to be expected with
               the standard C++ behavior.

     Return    A zDate object with the new date value.

     See also  zDate::operator+=(); zDate::operator++(0

     Example   zDate date1(zDate::oct, 3, 1996);
               zDate date2 = date1 + 55;
               assert( date2 == zDate(zDate::nov, 27, 1996) );


   ZDATE::OPERATOR++
   --------------------------------------------------------------------------
     Synopsis  Increments the date object by 1 day.

     Syntax    zDate operator++();
               zDate operator++(int);

     Remarks   This is a simple increment operator which will increase the
               current date object by 1 day. Note that both prefix and
               postfix versions are supported. These behave in the standard
               C++ way (i.e. the prefix version will cause the date object
               to be modified and then the new value returned, while the
               postfix version will cause the date object to be modified,
               but its old value will be returned).

     Return    Prefix version returns incremented value of object;
               Postfix version returns the value of the object before
               the modification.

     See also  zDate::operator+=(); zDate::operator

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -