#include "cgeneral.h"
#include "cdate.h"
#include "mdydate.h"
Defines | |
#define | JPMCDS_SUNDAY 0 |
#define | JPMCDS_MONDAY 1 |
#define | JPMCDS_TUESDAY 2 |
#define | JPMCDS_WEDNESDAY 3 |
#define | JPMCDS_THURSDAY 4 |
#define | JPMCDS_FRIDAY 5 |
#define | JPMCDS_SATURDAY 6 |
#define | JPMCDS_TDATE_BASE_YEAR 1601 |
#define | JPMCDS_IS_LEAP(year) |
Functions | |
TDate | JpmcdsDate (long year, long month, long day) |
Converts year, month, day to a date and returns the date. | |
int | JpmcdsDateToMDY (TDate date, TMonthDayYear *mdyDate) |
Converts TDate to Month, Day, Year. | |
int | JpmcdsMDYToDate (TMonthDayYear *mdyDate, TDate *date) |
Converts Month, Day, Year to TDate. | |
int | JpmcdsDayOfWeek (TDate date, long *dayOfWeek) |
Converts TDate to day of week (0-6). | |
int | JpmcdsNormalizeMDY (TMonthDayYear *mdy) |
Normalizes a month/day/year. | |
int | JpmcdsDaysInMonth (long year, long month) |
Returns # days in month. | |
int | JpmcdsDateToEOM (TDate inDate, TDate *outDate) |
Moves a date to the end of the current month. |
#define JPMCDS_IS_LEAP | ( | year | ) |
Value:
( \ (((year)%4 == 0) && ((year)%100 != 0)) || \ ((year)%400 == 0) \ )
TDate JpmcdsDate | ( | long | year, | |
long | month, | |||
long | day | |||
) |
Converts year, month, day to a date and returns the date.
This is useful for initializing dates within test routines. Returns FAILURE for invalid dates.
int JpmcdsDateToMDY | ( | TDate | date, | |
TMonthDayYear * | mdyDate | |||
) |
Converts TDate to Month, Day, Year.
NOTE: routine was written to avoid divides especially as well as multiplies. Whenever possible, the type int is used-which is presumably the fastest type on a given architecture.
int JpmcdsDayOfWeek | ( | TDate | date, | |
long * | dayOfWeek | |||
) |
Converts TDate to day of week (0-6).
0 is Sunday, 1 is Monday.... 6 is Saturday
int JpmcdsMDYToDate | ( | TMonthDayYear * | mdyDate, | |
TDate * | date | |||
) |
Converts Month, Day, Year to TDate.
NOTE: routine was written to avoid divides (especially) and multiplies.
int JpmcdsNormalizeMDY | ( | TMonthDayYear * | mdy | ) |
Normalizes a month/day/year.
If month is out of range, it is brought into range, and the years are incremented or decremented as appropriate. If day belongs to a month/year combination which does not exist, (such as April 31) the day is reduced so that it becomes valid.(to April 30).