12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /************************************************************************/
- /*
- 文件名称: CalendarEx.h
- 文件标识:
- 内容摘要: 日期转换类;
- 其它说明: 无
- 当前版本: V 0.1
- 作 者: Jeff
- 完成日期: 2015年05月14日
- 修改记录1:
- 修改日期:-
- 版 本 号:-
- 修 改 人:-
- 修改内容:-
- */
- /************************************************************************/
- #ifndef __CALENDAREX_HEADER__
- #define __CALENDAREX_HEADER__
- #include <ctime>
- #include <cassert>
- #include <cstring>
- #include <iostream>
- using namespace std;
- //保存一个农历日期;
- typedef struct _STDATE_
- {
- int year;
- int month;
- int day;
- bool leap; //是否闰月;
- } Date;
- #pragma once
- class CCalendarEx
- {
- CCalendarEx();
- public:
- ~CCalendarEx();
- static CCalendarEx* GetInstnace()
- {
- static CCalendarEx tagInstance;
- return &tagInstance;
- }
-
- int DayOfSolarYear(int year, int month, int day);
- bool IsValidLunanrDate(int lunar_year, int lunar_month, int lunar_day);
- // 公历转农历;
- Date SolarToLuanrDate(int solar_year, int solar_month, int solar_day);
- CString GetLunarDate(int solar_year, int solar_month, int solar_day);
- // 农历转公历;
- CString LuanrToSolarDate(int lunar_year, int lunar_month, int lunar_day, BOOL bLeap = FALSE);
- };
- #endif
|