本文整理匯總了Java中java.time.LocalDate.lengthOfMonth方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.lengthOfMonth方法的具體用法?Java LocalDate.lengthOfMonth怎麽用?Java LocalDate.lengthOfMonth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.time.LocalDate
的用法示例。
在下文中一共展示了LocalDate.lengthOfMonth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initTimeline
import java.time.LocalDate; //導入方法依賴的package包/類
private void initTimeline(LocalDate start, LocalDate end) {
this.timelineStart = start;
this.timelineEnd = end;
for(int m = start.getMonthValue(); m <= end.getMonthValue(); m++) {
TableColumn<GanttTask,GanttBarPiece> monthCol = new TableColumn<GanttTask,GanttBarPiece>();
Label month = new Label(Month.of(m).toString());
monthCol.setGraphic(month);
monthCol.setResizable(false);
LocalDate tmp = LocalDate.of(start.getYear(), m, 1);
LocalDate chartStart = start.compareTo(tmp) > 0 ? start : tmp;
for(int d = chartStart.getDayOfMonth(); d <= chartStart.lengthOfMonth(); d++) {
GanttDayColumn c = new GanttDayColumn(chartStart.getYear(), m, d);
c.setPrefWidth(20);
Label day = new Label(Integer.toString(d));
c.setGraphic(day);
monthCol.getColumns().add(c);
}
this.getColumns().add(monthCol);
}
// TODO make timeline right-left scrollable with wheel on windows
}
示例2: daysInMonth
import java.time.LocalDate; //導入方法依賴的package包/類
/**
* This method returns the number of days of a month of the date passed as parameter.
* @param date {@link LocalDate}
* @return {@link Integer}
* @throws JSKException if some of the parameters are null.
*/
public static Integer daysInMonth(LocalDate date) throws JSKException {
if(isNull(date)) {
throw new JSKException(NULL_PARAMETERS);
}
return date.lengthOfMonth();
}
示例3: haalLaatsteDagVanDeMaandOp
import java.time.LocalDate; //導入方法依賴的package包/類
/**
* Haalt de laatste dag van de maand op.
* @param datum de datum waarvan de laatste wordt opgehaald.
* @return de laatste dag van de maand.
*/
public static int haalLaatsteDagVanDeMaandOp(final int datum) {
final int jaar = datum % MOD_JAAR / MOD_MAAND;
final int maand = datum % MOD_MAAND / MOD_DAG;
final LocalDate date = LocalDate.of(jaar, maand, 1);
return date.lengthOfMonth();
}