12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef __CALENDAREX_20160127__
- #define __CALENDAREX_20160127__
- #pragma once
- #ifndef IN
- #define IN
- #endif
- #ifndef OUT
- #define OUT
- #endif
- namespace CalendarEx
- {
- //保存一个农历日期;
- typedef struct _STLUNARDATE_
- {
- int nYear;
- int nMonth;
- int nDay;
- bool bIsLeapMonth; //是否闰月;
- _STLUNARDATE_() {
- nYear = 0;
- nMonth = 0;
- nDay = 0;
- bIsLeapMonth = false;
- }
- } LunarDate, *pLunarDate;
- // 农历日期有效性;
- bool IsValidLunanrDate(IN const TCHAR* lpLunarDate );
- // 农历日期有效性;
- bool IsValidLunanrDate(IN const int &nLunarYear, IN const int &nLunarMonth, IN const int &nLunarDay);
- // 公历日期有效性;
- bool IsValidSolarDate(IN const TCHAR* lpSolarDate);
- // 公历日期有效性;
- bool IsValidSolarDate(
- IN const int &nSolarYear,
- IN const int &nSolarMonth,
- IN const int &nSolarDay);
- // 返回指定日期在当年的第几天;
- int DayOfSolarYear(
- IN const int &nSolarYear,
- IN const int &nSolarMonth,
- IN const int &nSolarDay);
- // 返回指定日期在当年的第几周;
- int DayOfSolarWeek(
- IN const int &nSolarYear,
- IN const int &nSolarMonth,
- IN const int &nSolarDay);
- // 公历转农历;
- bool SolarToLuanrDate(
- IN const int &nSolarYear,
- IN const int &nSolarMonth,
- IN const int &nSolarDay,
- OUT LunarDate &lnaDate);
- // 公历转农历;
- bool SolarToLuanrDate(
- IN const int &nSolarYear,
- IN const int &nSolarMonth,
- IN const int &nSolarDay,
- OUT TCHAR* lpLunarDate);
- // 农历转公历;
- bool LuanrToSolarDate(
- IN const int &nLunarYear,
- IN const int &nLunarMonth,
- IN const int &nLunarDay,
- OUT LunarDate &lnaDate,
- IN bool bIsLeapMonth = false );
- bool LuanrToSolarDate(
- IN const int &nLunarYear,
- IN const int &nLunarMonth,
- IN const int &nLunarDay,
- OUT TCHAR* lpSolarDate,
- IN bool bIsLeapMonth = false );
- bool LuanrToSolarDate( IN const TCHAR* lpLunarDate, OUT TCHAR* lpSolarDate, IN bool bIsLeapMonth = false);
- // 返回某一年的闰月月份;
- int IsLeapMonth(IN const int &nLunarYear);
- // 计算年龄,返回周岁;
- int GetAge(IN const TCHAR* lpLunarBirthDay, IN bool bIsLeapMonth = false);
- };
- #endif
|