请各位原谅我的无知吧。但我真的不知道。
就是在android中怎样把一个日期给格式化。
年月日时分秒的

解决方案 »

  1.   

    String.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis());看看行不!
      

  2.   

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = sdf.parse(“2012-9-13 10:00:00”);
    String create_time = formatter.format(date.getTime());
      

  3.   


    Calendar cal = Calendar.getInstance();
    String.format("%04d-%02d-%02d %02d:%02d:%02d",            cal.get(Calendar.YEAR),        cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
      

  4.   


    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateString=sdf.format(yourTime);
      

  5.   

    刚才真是够呛,不让编辑,还不让删除,重发下吧Calendar cal = Calendar.getInstance();
    String.format("%04d-%02d-%02d %02d:%02d:%02d",                                                               cal.get(Calendar.YEAR),                                                          cal.get(Calendar.MONTH)+1,                                                    cal.get(Calendar.DAY_OF_MONTH),                                                    cal.get(Calendar.HOUR_OF_DAY),                                                    cal.get(Calendar.MINUTE),                                                    cal.get(Calendar.SECOND));