JAVA issue highlights I and java issues
1. Java date Addition
Import java. util. date; date = new date (); // obtain the time Calendar calendar = new GregorianCalendar (); calendar. setTime (date); calendar. add (calendar. DATE, 1); // Add a day after the DATE. the integer is pushed back, and the negative number moves forward date = calendar ar. getTime (); // this time is the result of one day after the date.
2. Convert String to Date or Date to String
Java is used for this conversion. text. simpleDateFormat string to Date type: Method 1: also the simplest method date Date = new Date ("2008-04-14"); Method 2: simpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd"); // The lower-case mm indicates the minute String dstr = ""; java. util. date date = sdf. parse (dstr); convert a date to a string: SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd"); java. util. date date = new java. util. date (); String str = sdf. format (date );