how to add number of days to the date given in a jtextfield with string data type

后端 未结 3 1337
梦毁少年i
梦毁少年i 2021-01-21 08:42

Good Day . I just wanna ask about adding days in a given date. I have a jtexfield (txtStart) and another jtexfield(txtExpiry). I need to display in txtExpiry the date after 102

3条回答
  •  难免孤独
    2021-01-21 09:06

    Once you have the correct format, you could use JodaTime. You could parse the String value directly using JodaTime, but since you've already done that, I've not bothered...

    Date date = ...;
    DateTime dt = new DateTime(date);
    dt = dt.plusDays(102);
    date = dt.toDate();
    

提交回复
热议问题