Adding Days to Calendar

后端 未结 4 1388
独厮守ぢ
独厮守ぢ 2021-01-05 07:08

I\'m new to this site and I have just started learning Java. I\'m trying to add couple days to the GregorianCalendar but it doesn\'t work. Here... (Ignore the top chunk), it

4条回答
  •  鱼传尺愫
    2021-01-05 07:35

    Gregorian calander has its own value you should be using to tell it what you are increasing where you are saying

    setup.add(day, -1);
    

    you should use the Gregorian calander value for day

    setup.add(Calendar.DAY_OF_MONTH, -1);
    

提交回复
热议问题