Dates
Chapter Updated 07/08/26
| Specifier | Replaced by | Example |
|---|---|---|
| %a | Abbreviated weekday name | Thu |
| %A | Full weekday name | Thursday |
| %b | Abbreviated month name | Aug |
| %B | Full month name | August |
| %c | Date and time representation | Thu Aug 23 14:55:02 2001 |
| %C | Year divided by 100 and truncated to integer (00-99) | 20 |
| %d | Day of the month, zero-padded (01-31) | 23 |
| %D | Short MM/DD/YY date, equivalent to %m/%d/%y | 08/23/01 |
| %e | Day of the month, space-padded ( 1-31) | 23 |
| %F | Short YYYY-MM-DD date, equivalent to %Y-%m-%d | 2001-08-23 |
| %g | Week-based year, last two digits (00-99) | 01 |
| %G | Week-based year | 2001 |
| %h | Abbreviated month name (same as %b) | Aug |
| %j | Day of the year (001-366) | 235 |
| %m | Month as a decimal number (01-12) | 08 |
| %n | New-line character | |
| %t | Horizontal-tab character | |
| %u | ISO 8601 weekday as number with Monday as 1 (1-7) | 4 |
| %U | Week number with the first Sunday as the first day of week one (00-53) | 33 |
| %V | ISO 8601 week number (01-53) | 34 |
| %w | Weekday as a decimal number with Sunday as 0 (0-6) | 4 |
| %W | Week number with the first Monday as the first day of week one (00-53) | 34 |
| %x | Date representation | 08/23/01 |
| %y | Year, last two digits (00-99) | 01 |
| %Y | Year | 2001 |
| %% | A % sign | % |
| Method | Description |
|---|---|
| xbDate() xbDate( const char * sDate8 ) xbDate( const xbDate &dtDate ) xbDate( const xbString &sDate8 ) xbDate( xbInt16 iMonth, xbInt16 iDay, xbInt16 iYear4 ) xbDate( time_t tInDt ) | Various xbDate constructors. |
| xbDate( xbUInt32 iOpt ) | Initialization xbDate constructor or Julian date. -1 Null Date 0 Sysdate Julian Date |
| ~xbDate() | Destructor |
| xbInt16 CalcRollingCenturyForYear( xbInt16 year ) const | Calculate century for a give 2 digit year. Uses 80/20 method. |
| xbInt16 CenturyOf() const | Return century of the date. |
| xbInt16 CharDayOf( xbString &sOutCharDay ) | Retrieve the character day. |
| xbInt16 CharMonthOf( xbString &sOutCharMonth ) | Retrive the character month. |
| xbInt16 CTOD( const xbString &sCtodInDate ) | Sets the date from input date in format MM/DD/YY |
| xbBool DateIsValid ( const xbString &sDate8 ) const; | Check if a given date is valid. |
| xbInt16 DayOf( xbInt16 iFormat ) const | Return Day of week, month or year depending on the option. |
| void Dump( const char * sTitle ) | Dump class internals. Available if XB_DEBUG_SUPPORT option compiled into library. |
| void DumpDateTables() | Dump internal date structures. Available if XB_DEBUG_SUPPORT option compiled into library. |
| xbInt16 FormatDate( const xbString &sFmtIn, xbString &sFmtOut ) Depreciated method. This is the original xbase date format routine and uses a different set of format specifiers. Xbase64 users are advised to migrate away from using this method and use the newer versions. Support for this method will be dropped in future versions. | Create a formatted date string based on input format.
1) YYDDD - A julian date format 2) YY or YYYY will print a 2 or 4 digit year 3) M,MM,MMM or MMMM 4) D,DD,DDD or DDDD Format Examples: The default format is MM/DD/YY |
| const xbString &GetDateFormat() const | Returns the date format for a given date. Returns the date format if set, else returns the system date format. |
| const xbString &GetDefaultDateFormat() const | Rethe default date format. |
| xbBool IsLeapYear( xbInt16 iYear ) const xbBool IsLeapYear() const | Returns true if leap year, otherwise returns false. |
| xbBool IsNull() const | Returns xbTrue is the date is null, else returns false. |
| xbInt32 JulianDays() const | Return the Julian days value. |
| xbInt16 JulToDate8( xbInt32 lJulDate ) | Convert a Julian date to xbDate value. |
| xbInt16 LastDayOfMonth() | Calculate the last day of a month for the date object. |
| xbInt16 MonthOf() const | Return the numeric month of the date. |
| xbBool operator!=( const xbDate & ) const | Compare for not equal dates. |
| const char * operator+( xbInt32 i ) | Add i days to a date. |
| void operator++( xbInt32 i ) | Increment a date. |
| void operator+=( xbInt32 i ) | Increment a date. |
| xbInt32 operator-( const xbDate & ) const | Determine the number of days between two dates. |
| const char * operator-( xbInt32 i ) | Subtract i days from a date. |
| void operator--( xbInt32 i ) | Decrement a date. |
| void operator-=( xbInt32 i ) | Decrement a date. |
| xbBool operator< ( const xbDate & ) const | Compare for less than date. |
| xbBool operator<=( const xbDate & ) const | Compare for less than or euql to date. |
| void operator=( const xbDate &d ) | Set a date equal to another date. |
| xbBool operator==( const xbDate & ) const | Compare for equal dates. |
| xbBool operator> ( const xbDate & ) const | Compare for greater than date. |
| xbBool operator>=( const xbDate & ) const | Compare for greater than or equal to date. |
| xbInt16 Set( const xbString &Date8 ) xbInt16 Set( xbInt16 iMonth, xbInt16 iDaty, xbInt16 iYear) | Set the date to valid input date. |
| void SetDateFormat( const char *sFmtIn ) void SetDateFormat( xbString &sFmtIn ) | Set date format for a given date. |
| void SetDefaultDateFormat( const xbString &sFmtIn ) | Set default date format. |
| void SetNull() | Set the date to null. |
| const char *Str() const | Return a pointer the date value Returns CCYYMMDD value. |
| const char *Strf() const | Return a pointer the formatted date value as determined by the specified date format. |
| void Sysdate() | Set the date to the system date. |
| xbInt16 YearOf() const | Return the numeric year of the date. |
