日期:orm
DTAE 表示到一个毫秒值,距离1970年7月1日的毫秒值。字符串
Canlendar用来操做日历时间的类get
DATAformat解析时间日期的字符串。form
1 毫秒值与date类型之间的转化:date
毫秒值转化为时间类型:方法
Long time=2132132131231;im
经过构造方法:数据
Date d=new Date(time);时间
经过settime转化。字符
New Date.settime(time);
Date转化为毫秒值:
Data.Gettime()
2 时间类型数据的解析为字符串类型
用dateformat
DateFormat dft=dateformat.getDateInstance(x);//x为dateformat的字段摘要
String str=dft.DateFormat();
用simpleDateFormat,此类为解析自定义格式的时间格式,转成String字符串
String str=”2014/06/11/12:56”
Simpledateformat slf=new simpledateformat(x);x为解析的格式:“yyyy/MM/dd/HH:mm”
3字符串类型转化为时间类型
1 用simpledateformat 格式化自定义格式的字符串
String str="2014/4/11";
SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd");
System.out.println(sdf.parse(str));
2 用dataformat格式化已有格式的字符串
String str="2014年4月11日";
DateFormat dft=DateFormat.getDateInstance(DateFormat.LONG);
System.out.println(dft.parse(str));