android获取年月日时分秒

Calendar calendar=Calendar.getInstance();  //获取当前时间,作为图标的名字
            String year=calendar.get(Calendar.YEAR)+"";
            String month=calendar.get(Calendar.MONTH)+1+"";
            String day=calendar.get(Calendar.DAY_OF_MONTH)+"";
            String hour=calendar.get(Calendar.HOUR_OF_DAY)+"";
            String minute=calendar.get(Calendar.MINUTE)+"";
            String second=calendar.get(Calendar.SECOND)+"";
            String time=year+month+day+hour+minute+second;

 

posted @ 2016-05-05 16:48  zqxLonely  阅读(11496)  评论(0编辑  收藏  举报