📄 lunarcalendar.h
字号:
#ifndef __MY_LUNARCALENDAR_H__
#define __MY_LUNARCALENDAR_H__
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned int BOOL;
typedef long LONG;
typedef struct _lunarcalendar LunarCalendar;
#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
#define LOWORD(l) ((WORD)(l))
#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
//返回阴历iLunarYear年的闰月月份,如没有返回0,从1901年1月---2050年12月
WORD GetLeapMonth (WORD iLunarYear);
//返回阳历iYear年iMonth月的天数,从1年1月 --- 65535年12月
WORD MonthDays(WORD iYear, WORD iMonth);
//计算阳历iYear,iMonth,iDay对应是星期几,从1年1月1日 --- 65535年12月31日
WORD WeekDay(WORD iYear, WORD iMonth, WORD iDay);
//检查阴历LunarMonth月,阴历LunarDay日是否为中国民间节日,是返回1否则返回0BOOL DayIsHoliday(WORD LunarYear, WORD LunarMonth, WORD LunarDay, char *buffer);//计算公历两个日期间相差的天数 1年1月1日 --- 65535年12月31日
LONG CalcDateDiff(WORD iEndYear, WORD iEndMonth, WORD iEndDay,
WORD iStartYear, WORD iStartMonth, WORD iStartDay);
//计算从1901年1月1日过iSpanDays天后的阴历日期
BYTE CalcLunarDate(WORD *iYear, WORD *iMonth ,WORD *iDay, LONG iSpanDays);//计算公历iYear年iMonth月iDay日对应的阴历日期,返回对应的阴历节气 0-24(从1901.1.1--2050.12.31)
WORD GetLunarDate(WORD iYear, WORD iMonth, WORD iDay,
WORD *iLunarYear, WORD *iLunarMonth, WORD *iLunarDay);
//把阴历iYear年格式化成天干记年法表示的字符串
void FormatLunarYear(WORD iYear, char *pBuffer);
//把阴历iMonth格式化成中文字符串
void FormatMonth(WORD iMonth, char *pBuffer, BOOL bLunar);
//把阴历iDay格式化成中文字符串
void FormatLunarDay(WORD iDay, char *pBuffer);
//根据GetLunarDate()函数返回的节气信息得到中文节气表示字符串
void PaintChineseInfo(char *pBuffer, WORD iHolDay);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MY_LUNARCALENDAR_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -