Top | ![]() |
![]() |
![]() |
![]() |
GQuark | lunar_date_error_quark () |
LunarDate * | lunar_date_new () |
void | lunar_date_set_solar_date () |
void | lunar_date_set_lunar_date () |
void | lunar_date_set_solar_holiday () |
void | lunar_date_set_lunar_holiday () |
void | lunar_date_set_week_holiday () |
gchar * | lunar_date_get_holiday () |
gchar * | lunar_date_get_calendar () |
gchar * | lunar_date_strftime () |
void | lunar_date_free () |
gchar * | lunar_date_get_jieri () |
LunarDate *
lunar_date_new (void
);
Allocates a LunarDate and initializes it. Free the return value with lunar_date_free()
.
Since: 2.4.0
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. |
Since: 2.4.0
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. |
Since: 2.4.0
void lunar_date_set_solar_holiday (LunarDate *date
,GDateMonth month
,GDateDay day
,const gchar *holiday
);
Add new holiday by solar.
date |
||
month |
Solar month of the holiday. |
|
day |
Solar day of the holiday. |
|
holiday |
custom holiday string. |
Since: 3.0.0
void lunar_date_set_lunar_holiday (LunarDate *date
,GDateMonth month
,GDateDay day
,const gchar *holiday
);
Add new holiday by lunar.
date |
||
month |
Lunar month of the holiday. |
|
day |
Lunar day of the holiday. |
|
holiday |
custom holiday string. |
Since: 3.0.0
void lunar_date_set_week_holiday (LunarDate *date
,GDateMonth month
,gint week_of_month
,gint day_of_week
,const gchar *holiday
);
Add new holiday by week.
date |
||
month |
Month of the holiday. |
|
week_of_month |
which week of the month, the first week is 1, range is 1-5. |
|
day_of_week |
day of the week, 0 for Sunday, 6 for Saturday, range is 0-6. |
|
holiday |
custom holiday string. |
Since: 3.0.0
gchar * lunar_date_get_holiday (LunarDate *date
,const gchar *delimiter
);
Returns the all holiday of the date, joined with the delimiter. The date must be valid.
Since: 3.0.0
gchar * lunar_date_get_calendar (LunarDate *date
,gint max
);
Returns the string about the date, used to show in calendar.
Since: 3.0.0
gchar * lunar_date_strftime (LunarDate *date
,const gchar *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) 生肖:猪
%(holiday) 节日(节日、纪念日、节气等):立春
使用%(holiday)时,输出会自动截断为3个utf8字符或4个ascii字符,如果需要全部的节日信息,请使用 lunar_date_get_holiday()
得到输出。
Since: 2.4.0
void
lunar_date_free (LunarDate *date
);
Frees a LunarDate returned from lunar_date_new()
.
Since: 2.4.0
gchar * lunar_date_get_jieri (LunarDate *date
,const gchar *delimiter
);
lunar_date_get_jieri
has been deprecated since version 3.0.0 and should not be used in newly-written code.
Use lunar_date_get_holiday()
instead.
Returns the all holiday of the date, joined with the delimiter. The date must be valid.