Android SimpleDateFormat.format(Date)问题

时间:2013-10-10 20:59:47

标签: java android date format simpledateformat

我不知道是否有人遇到过我今天遇到的同样问题:使用SimpleDateFormat.format(Date)在输出字符串中附加了奇怪的“00”。 这是我的代码:

    for (int i=0; i<100; i++)
    {
        SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm", Locale.getDefault());
        long timestamp = System.currentTimeMillis();
        Log.d(log_tag, "current date time is"+dateformatter.format(new Date(timestamp)));
    }

因此,我的屏幕上的100个打印输出是

的组合
2013-10-10-hh-mm
2013-0010-10-hh-mm
2013-10-0010-hh-mm
etc. 

它在月/日/小时/分钟前附加“00”。真的很奇怪。我很好奇它是怎么做到的?

0 个答案:

没有答案