The code is simple and the functions are very practical, so I won’t talk much nonsense here.
public Date getdate(int i) // // Get the date i before and after which is a positive number and delay it backwards i day, and when the negative number is negative, it is forward i day { Date dat = null; Calendar cd = Calendar.getInstance(); cd.add( Calendar.DATE, i); dat = cd.getTime(); SimpleDateFormat dformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Timestamp date = Timestamp.valueOf(dformat.format(dat)); return date; } The above code is all the content described in this article, I hope you like it.
Please take some time to share the article with your friends or leave a comment. We will sincerely thank you for your support!