/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package date;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
/**
*
* @author DR_lyh
*/
public class DateDate {
public static void main(String[] args) {
/* Date today=new Date();
* System.out.println("今天是:" + today.toLocaleString());
* Date birthday = new Date(2014-1900, 11,12);
System.out.println("生日是:" +birthday.toLocaleString()) ;
*/
Date shijian=new Date();
DateFormat time = DateFormat.getDateTimeInstance();
DateFormat time1 = DateFormat.getDateInstance();
System.out.println("今天是:"+ time.format(shijian));
System.out.println("今天是:"+ time1.format(shijian));
/* Date birthday=new Date(222-1900,12-1,15);
System.out.println("生日是:" + birthday.toLocaleString());
*/
Date day=new Date();
DateFormat time2=DateFormat.getDateTimeInstance();//对时间进行格式化。与时间同步
System.out.println(" 今天是:" + time2.format(day));
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package date;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
/**
*
* @author DR_lyh
*/
public class DateDate {
public static void main(String[] args) {
/* Date today=new Date();
* System.out.println("今天是:" + today.toLocaleString());
* Date birthday = new Date(2014-1900, 11,12);
System.out.println("生日是:" +birthday.toLocaleString()) ;
*/
Date shijian=new Date();
DateFormat time = DateFormat.getDateTimeInstance();
DateFormat time1 = DateFormat.getDateInstance();
System.out.println("今天是:"+ time.format(shijian));
System.out.println("今天是:"+ time1.format(shijian));
/* Date birthday=new Date(222-1900,12-1,15);
System.out.println("生日是:" + birthday.toLocaleString());
*/
Date day=new Date();
DateFormat time2=DateFormat.getDateTimeInstance();//对时间进行格式化。与时间同步
System.out.println(" 今天是:" + time2.format(day));
}
}