`

Android获取系统时间

 
阅读更多
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss");//hh12小时
Date curDate = new Date(System.currentTimeMillis());//获取当前时间    HH24小时
String str = formatter.format(curDate);

 ------------------------------------------------------------------华丽的分割线----------------------------------------------------

 

 

SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String date = sDateFormat.format(new java.util.Date());

 ------------------------------------------------------------------华丽的分割线----------------------------------------------------

 

SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");  
String date=sdf.format(new java.util.Date()); 

 -------------------------------------------------------------------华丽的分割线---------------------------------------------------

 

df = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL,Locale.CHINA);
System.out.println(df.format(new Date()));
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics