java 获取date的月份

代码如下

private Integer getMonth(Date date) {
    
    
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    int month = cal.get(Calendar.MONTH);

    return Integer.valueOf(month);
}

猜你喜欢

转载自blog.csdn.net/qq_34626094/article/details/123459138
今日推荐