SimpleDateFormat格式化日期
2012-11-09 10:09
357 查看
import java.text.SimpleDateFormat;
import java.util.Date;
public class test {
public static void main(String []aa){
SimpleDateFormat dateformat1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E");
String a1=dateformat1.format(new Date());
System.out.println("时间2:"+a1);
System.out.println(new Date().getYear()+1900);
SimpleDateFormat dateformat2=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 E ");
String a2=dateformat2.format(new Date());
System.out.println("时间2:"+a2);
}
}
每次都忘记 SimpleDateFormat data的格式用法。这次留在博客里面方便以后用。
import java.util.Date;
public class test {
public static void main(String []aa){
SimpleDateFormat dateformat1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E");
String a1=dateformat1.format(new Date());
System.out.println("时间2:"+a1);
System.out.println(new Date().getYear()+1900);
SimpleDateFormat dateformat2=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 E ");
String a2=dateformat2.format(new Date());
System.out.println("时间2:"+a2);
}
}
每次都忘记 SimpleDateFormat data的格式用法。这次留在博客里面方便以后用。
相关文章推荐
- java SimpleDateFormat格式化输出日期
- JAVA 利用SimpleDateFormat将String转换为格式化的日期
- Java进阶(二十八)SimpleDateFormat格式化日期问题
- Java格式化日期类DateFormat和SimpleDateFormat的学习
- 《黑马程序员》 日期Data类,日期格式化DateFormat,自定义格式化SimpleDateFormat的使用
- Java日期格式化及其使用例子收集 SimpleDateFormat担当重任,怎样格式化都行
- 用SimpleDateFormat格式化日期和时间
- SimpleDateFormat格式化日期
- java综合:SimpleDateFormat格式化日期
- 使用 SimpleDateFormat 类格式化日期
- 使用 SimpleDateFormat 格式化日期和使用printf格式化日期
- SimpleDateFormat 日期格式化
- 格式化日期:SimpleDateFormat
- SimpleDateFormat格式化日期
- 使用SimpleDateFormat格式化日期
- SimpleDateFormat 日期格式化
- Java中SimpleDateFormat格式化日期用法
- SimpleDateFormat格式化日期时间格式
- java 使用simpleDateFormat格式化日期 时间
- SimpleDateFormat格式化日期