时间格式化02
来源:互联网 发布:网络mr是什么意思啊 编辑:程序博客网 时间:2024/05/17 09:07
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateTimeDemo02 {
private SimpleDateFormat sdf = null;
public String getDate() {// 2010-04-22
this.sdf = new SimpleDateFormat("yyyy-MM-dd");
String str = this.sdf.format(new Date());
return str;
}
public String getDateTime() {// 2010-04-22 16:19:34.123
this.sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
String str = this.sdf.format(new Date());
return str;
}
public String getDateComplete() {// 2010年04月22日
this.sdf = new SimpleDateFormat("yyyy年MM月dd日");
String str = this.sdf.format(new Date());
return str;
}
public String getDateTimeComplete() {// 2010年04月22日16时19分34秒123毫秒
this.sdf = new SimpleDateFormat("yyyy年MM月dd日 hh时mm分ss秒SSS毫秒");
String str = this.sdf.format(new Date());
return str;
}
public String getDateTimeStamp() {
this.sdf = new SimpleDateFormat("yyyyMMddhhmmssSSS");
String str = this.sdf.format(new Date());
return str;
}
public static void main(String args[]) {
DateTimeDemo02 dt = new DateTimeDemo02();
System.out.println(dt.getDateTimeComplete());
System.out.println(dt.getDateTime());
System.out.println(dt.getDateTimeStamp());
}
}
- 时间格式化02
- 格式化时间
- 格式化时间
- 时间格式化
- 格式化时间
- 时间格式化
- 格式化时间
- 格式化时间
- 格式化时间
- 格式化时间
- 格式化时间
- 时间格式化
- 时间格式化
- 格式化时间
- 时间格式化
- 时间格式化
- 时间格式化
- 时间格式化
- 规范化的C++编程方法备忘录 程序流程(2)
- hibernate复习中
- vs .net 快捷鍵大全
- 爱情语录
- 关于Activity和Task的设计思路和方法
- 时间格式化02
- 规范化的C++编程方法备忘录 c++ for windows
- 碎片3
- VS2010之我见
- CSS的十八般技巧
- web上用Activex控件开发步骤
- C++类中的字节对齐
- 规范化的C++编程方法备忘录 c++ for windows(2)
- 研究生答辩的关键