使用 Jambi 创建自定义日历
Creating Custom Calendar with Jambi
制作自定义日历时,如何设置日期并获取当月的总天数?或者甚至获取该特定日期的工作日?
比如四月是30天,五月是31天 , 2 月 每 4 年 是 29 天 并且每年的工作日都不一样.
我正在使用 Jambi(java 中的 Qt 4.7),我想用很少的 QComboBox
制作日历,我使用 QDate
来获取当前日期,如下所示:
//return current year
QDate.currentDate().year();
//return total days in current month
QDate.currentDate().daysInMonth();
//return current month
QDate.currentDate().month();
//return current day in month
QDate.currentDate().day();
//return current day in week
QDate.currentDate().dayOfWeek();
问题是我得到的是 当前 信息。
- 我怎么能问 2020 月 2 月 ,多少 天 在里面吗?
- 而10th、February、2020是中的哪一天周?
我查看了 QData documentation,我找不到任何设置日期的选项以便我可以从中获取信息,有什么想法吗?
只需使用 constructor 传递您想要的日期?
例如:
QDate date = new QDate(202, 2, 1);
date.daysInMonth();
制作自定义日历时,如何设置日期并获取当月的总天数?或者甚至获取该特定日期的工作日? 比如四月是30天,五月是31天 , 2 月 每 4 年 是 29 天 并且每年的工作日都不一样.
我正在使用 Jambi(java 中的 Qt 4.7),我想用很少的 QComboBox
制作日历,我使用 QDate
来获取当前日期,如下所示:
//return current year
QDate.currentDate().year();
//return total days in current month
QDate.currentDate().daysInMonth();
//return current month
QDate.currentDate().month();
//return current day in month
QDate.currentDate().day();
//return current day in week
QDate.currentDate().dayOfWeek();
问题是我得到的是 当前 信息。
- 我怎么能问 2020 月 2 月 ,多少 天 在里面吗?
- 而10th、February、2020是中的哪一天周?
我查看了 QData documentation,我找不到任何设置日期的选项以便我可以从中获取信息,有什么想法吗?
只需使用 constructor 传递您想要的日期?
例如:
QDate date = new QDate(202, 2, 1);
date.daysInMonth();