Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 57254662b08bab0259d9d4ac98ef679c > files > 47

lib64xbase2-devel-2.0.0-7mdv2008.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC>
<HTML>
<TITLE>Xbase DBMS Chapter 15</TITLE>
<BODY BGCOLOR=#FFFFFF>
<H1><p align="center">Date Methods</p></H1>
<p align="center">Chapter Updated 2/1/99</p><hr>
 
This chapter lists the date methods and provides examples of how to use them.<br><br>

All references to Date8 refer to a date with the format of CCYYMMDD.<br><br> 

<TABLE BORDER>
<CAPTION ALIGN="TOP"><h3>Xbase Date Method List</h3></CAPTION>
<TR><TH ALIGN="LEFT">Method<TD>Description
<TR><TH ALIGN="LEFT">char * CharDayOf(char *Date8)<TD>Returns pointer to (Sun - Sat) day of week
<TR><TH ALIGN="LEFT">char * CharMonthOf(char *Date8)<TD>Returns pointer to (Jan - Dec) month of year
<TR><TH ALIGN="LEFT">xbShort DateIsValid(char *Date8)<TD>Checks a date for validity
<TR><TH ALIGN="LEFT">xbShort DayOf(char *Date8)<TD>Returns the "day of WEEK, MONTH or YEAR" from a given date
<TR><TH ALIGN="LEFT">char * FormatDate(char *fmt,char *Date8)<TD>Return a pointer to a formatted date
<TR><TH ALIGN="LEFT">xbShort IsLeapYear(char *Date8)<TD>Returns TRUE if given date is a leap year
<TR><TH ALIGN="LEFT">xbLong JulianDays(char *Date8)<TD>Returns number of days since 1/1/1900 to given date
<TR><TH ALIGN="LEFT">char * JulToDate8(xbLong Days)<TD>Converts Julian date to CCYYMMDD format
<TR><TH ALIGN="LEFT">xbLong LastDayOfMonth(char *Date8)<TD>Returns julian day for the last day
  of the month for a given date.
<TR><TH ALIGN="LEFT">xbShort MonthOf(char *Date8)<TD>Returns month of a date
<TR><TH ALIGN="LEFT">char * Sysdate()<TD>Returns a pointer to the system date
<TR><TH ALIGN="LEFT">xbShort YearOf(char *Date8)<TD>Returns century and year of a date
</TABLE>
<br><br><br>
<hr>
<h2>Method Definitions</h2>
<hr>

<h3>Method: char * xbXBase::CharDayOf( char * Date8 )</h3><br>

<h4>Inputs:</h4>   Date8 - A valid date with the format of CCYYMMDD<br><br>

<h4>Returns:</h4>  A pointer to static buffer containing the
                 spelling of the day of the week (Monday-Sunday)<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: char * xbXBase::CharMonthOf( char * Date8 )</h3><br>

<h4>Inputs:</h4>   Date8 - A valid date with the format of CCYYMMDD<br><br>

<h4>Returns:</h4>  A pointer to static buffer contianing the
                 spelling of the month (January-December)<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: xbShort xbXBase::DateIsValid( char * Date8 )</h3><br>

<h4>Inputs:</h4>   Date8 - A valid date with the format CCYYMMDD<br><br>
<h4>Returns:</h4>  This method returns 1 if the input date is a valid
                 date, otherwise it returns 0.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: xbShort xbXBase::DayOf( xbShort Format, char * Date8 )</h3><br>

<h4>Inputs:</h4> 
<xmp> Valid values for Format are: 

      WEEK   for the day of the week (0 - Sunday through 6 - Saturday)
      MONTH  for the day of the month (1-31)
      YEAR   for the day of the year (1-366)

Beginning with release 1.7.4,  WEEK is now FMT_WEEK
                               MONTH is now FMT_MONTH
                               YEAR is now FMT_YEAR

 Date8 - A valid date with the format CCYYMMDD
</xmp>
<h4>Processing:</h4>    Based on the format type, calculate the day of
                  the week, month or year.<br><br>
<h4>Returns:</h4> This method returns the day of the year as an integer.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: char * xbXBase::FormatDate( char * Format, char * Date8 )</h3><br>

<h4>Inputs:</h4><xmp>
      Format - A format specifier with the following paramaters:

        1) YYDDD    -  A julian date format

        2) YY or YYYY will print a 2 or 4 digit year

        3) M,MM,MMM or MMMM

           M    - one digit month if no leading zero
           MM   - two digit month, contains leading zero 
           MMM  - Jan through Dec
           MMMM - January through December

        4) D,DD,DDD or DDDD
   
           D    - one digit dayif no leading zero
           DD   - two digit day, contains leading zero 
           DDD  - Sun through Sat (or julian if YYDDD)
           DDDD - Sunday through Saturday
</xmp>

 Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4>
A pointer to a static buffer which contains the reformatted date.  If the 
input format is an unknown type, the function returns the same date recieved.
    
<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: xbShort xbXBase::IsLeapYear( char * Date8 )</h3><br>

<h4>Inputs:</h4>  Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4>  This method returns 1 if the input date is a leap 
                  year, otherwise it returns 0.<br><br>
<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: xbLong xbXBase::JulianDays( char * Date8 )</h3><br>

<h4>Inputs:</h4> Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4> This method returns the number or of days since 19000101.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: char * xbXBase::JulToDate8( xbLong Days )</h3><br>

   This method is the compliment of method JulianDays.<br><br>  

<h4>Inputs:</h4> Days - A julian count of days since 19010101<br><br>

<h4>Returns:</h4> A date with the format of CCYYMMDD<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method: xbLong xbXBase::LastDayOfMonth( char * Date8 )</h3><br>

<h4>Inputs:</h4> Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4> This method returns the julina day for the last day of the 
month for the given input date.<br><br>

<hr>
<h3>Method: xbShort xbXBase::MonthOf( char * Date8 )</h3><br>

<h4>Inputs:</h4> Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4> This method returns the MM part of the date as
                  an integer.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method char * xbXBase::Sysdate()</h3><br>

<h4>Returns:</h4> This method returns a pointer to a static buufer
                  which contains the system date in CCYYMMDD format.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>

<h3>Method xbShort xbXBase::YearOf( char * Date8 )</h3><br>

<h4>Inputs:</h4> Date8 - A valid date with the format CCYYMMDD<br><br>

<h4>Returns:</h4> This method returns the CCYY part of the date
                  as an integer.<br><br>

<h4>Example:</h4>

See program <A HREF="/XbaseSamples/testdate.cpp">testdate.cpp</A> for an example of
how to use this method.
<hr>
<A HREF="mailto:xbase@startech.keller.tx.us">
Send me mail - xbase@startech.keller.tx.us</A><br>
<p>(c)1997 StarTech
<p><img src="xbase.jpg"><br><hr>
</BODY>
</HTML>