Top | ![]() |
![]() |
![]() |
![]() |
LunarDate * | lunar_date_new () |
void | lunar_date_set_solar_date () |
void | lunar_date_set_lunar_date () |
gchar * | lunar_date_get_jieri () |
gchar * | lunar_date_strftime () |
void | lunar_date_free () |
LunarDate *
lunar_date_new (void
);
Allocates a LunarDate and initializes it. Free the return value with lunar_date_free()
.
void lunar_date_set_solar_date (LunarDate *date
,GDateYear year
,GDateMonth month
,GDateDay day
,guint8 hour
,GError **error
);
Sets the solar year, month, day and the hour for a LunarDate.
date |
a LunarDate. |
|
year |
year to set. |
|
month |
month to set. |
|
day |
day to set. |
|
hour |
hour to set. |
|
error |
location to store the error occuring, or NULL to ignore errors. |
void lunar_date_set_lunar_date (LunarDate *date
,GDateYear year
,GDateMonth month
,GDateDay day
,guint8 hour
,gboolean isleap
,GError **error
);
Sets the lunar year, month, day and the hour for a LunarDate. If the month is a leap month, you should set the isleap to TRUE.
date |
a LunarDate. |
|
year |
year to set. |
|
month |
month to set. |
|
day |
day to set. |
|
hour |
hour to set. |
|
isleap |
indicate whether the month is a leap month. |
|
error |
location to store the error occuring, or NULL to ignore errors. |
gchar * lunar_date_get_jieri (LunarDate *date
,const gchar *delimiter
);
Returns the all holiday of the date, joined with the delimiter. The date must be valid.
a newly-allocated holiday string of the date. This can be changed in $XDG_CONFIG_HOME/liblunar/hodiday.dat file.
gchar * lunar_date_strftime (LunarDate *date
,const char *format
);
使用给定的格式来输出字符串。类似于strftime的用法。可使用的格式及输出如下:
%(YEAR)年%(MONTH)月%(DAY)%(HOUR)日 公历:大写->二OO八年一月二十一日
%(year)年%(month)月%(day)%(hour)日 公历:小写->2008年1月21日
%(NIAN)年%(YUE)月%(RI)日%(SHI)时 阴历:大写->丁亥年腊月十四日,(月份前带"闰"表示闰月)
%(nian)年%(yue)月%(ri)日%(shi)时 阴历:小写->2007年12月14日,(月份前带"*"表示闰月)
%(Y60)年%(M60)月%(D60)日%(H60)时 干支:大写->丁亥年癸丑月庚申日
%(Y8)年%(M8)月%(D8)日%(H8)时 八字:大写->丁亥年癸丑月庚申日
%(shengxiao) 生肖:猪 %(jieri) 节日(节日、纪念日、节气等):立春
使用%(jieri)时,如果此日没有节日或节气,那么将为空。 支持自定义节日,只要按照格式修改 $XDG_CONFIG_HOME/liblunar/hodiday.dat 文件即可。
void
lunar_date_free (LunarDate *date
);
Frees a LunarDate returned from lunar_date_new()
.