Write [java] date

package cn.bfdl;

import java.text.*;
import java.util.*;

the Text class {public
public static void main (String [] args) {throws a ParseException
String STR = "2020-10-10";
DateFormat new new DF = the SimpleDateFormat ( "the MM-dd-YYYY");
a Date DATE = df.parse ( STR);
Calendar the GregorianCalendar new new C = (); // Date and Calerdar difference: the former is easy to calculate the introduction, which display format
c.setTime (DATE);
}
}

You need to write the date in java

First to produce a DateFormat, which is a format class, production Date, because later date will be calculated, and finally the need to produce Calendar. This can be calculated.

Note: In May, foreign 0 to 11, China 1 to 12! ! !

 

Guess you like

Origin www.cnblogs.com/dandanduba/p/11320629.html