Prerequisites give a few days before and a day number, this day before N days before!
/ ** * Calculate a date for a few days * @Param strdate string * @param countdate string * @return string * / public static string Todatestr (String strDate, string countdate) {
SimpleDateFormat WEW = New SimpleDateFormat ("YYYY-MM-DD"); // Instantiation Refrigeration Class
Java.util.date aa; // Declare a recent variable long yihou; // Enter the recently converted long-type system calculation default is millisecond string dfdfd = ""; // Returned string TRY {AA = WEW. PARSE (STRDATE); // Get the variable transferred in the page and format the time format yihou = aa.gettime (); // Transform this time into a long-type timestamp system calculation default is milliseconds
Long tianshu = (Integer.Parseint (countdate)) * 24 * 60 * 60 * 1000; // Transfer days Calculate the default in milliseconds
Long jieguo = yihou tianshu; // Get added after adding timestamp
Java.util.date ddfdf = new date (jieguo); // declare a recent variable, and initiate the trial value
DFDFD = WEW.FORMAT (DDFDF); // Format Time System.out.Println (WEW.FORMAT (DDFDF));
} CatCH (Parsexception EX) {} returnifd; // Return characters}