/**
*
* @author TonieLau
*/
public class getDate {
public getDate() {
}
public static void main(String[] args) {
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH)+1;
int day = now.get(Calendar.DAY_OF_MONTH);
if(month<10){
System.out.println("今天是:"+year+"-0"+month+"-"+day);
} else {
System.out.println("今天是:"+year+"-"+month+"-"+day);
}
/**
*
* @author LiuTingYu
*/
public class getDate {
/** Creates a new instance of getTime */
public getDate() {
}
public static void main(String[] args) {
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH)+1;
int day = now.get(Calendar.DAY_OF_MONTH);
System.out.println("今天是:"+year+"-"+month+"-"+day);