Javaimplement date random jump
During the project development process. The setting of the order reminder date is required. The main include setting the monthly specified date or the specified number of days, code such as the following:
public static string Dateoperation (string type, date mydate, int num) {string date = null; SimpleDateFormat formatter = new SimpleDateFormat ("YyyyMMdd"); try {Calendar c = calendar.getinstance (); C.settime (mydate), if (Type.equals ("0")) {C.add (calendar.month, 1); mydate = C.gettime ();d ate = Formatter.format (mydate); String dt = date.substring (Date.length () -2,date.length ()); System.out.println ("date after interception: [" + dt + "]"); int days = num-integer.parseint (DT); System.out.println ("Days of Difference:" + day); C.add (calendar.date); mydate = C.gettime ();d ate = Formatter.format (mydate);} else if (type.equals ("1")) {C.add (calendar.date, num); mydate = C.gettime ();d ate = Formatter.format (mydate);} System.out.println ("Order Next Reminder Date: [" + Date + "]");} catch (Exception E1) {e1.printstacktrace ();} return date;}
Java Tools Class (iv) Implementation date random jump