Android中的简单格式日期解析失败

时间:2015-09-24 02:04:23

标签: java android date time

我用过

public static String getCurrentDateTime() {
        Date date = new Date(System.currentTimeMillis());

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

        String fDate = format.format(date);

        return fDate;
    }

将当前时间作为字符串在android中保存并保存到数据库中,它工作正常,直到我找到' 2015-09-23 12:48:04:55.845'在数据库中。 有人可以帮我解释为什么当时有一个额外的字段?感谢。

1 个答案:

答案 0 :(得分:1)

因为有人将该值插入数据库。

这是您的代码的早期迭代是否正常工作,代码中的其他位置,或者是直接插入/更新到数据库的人,这是未知的,并且很难找到,至少与我们掌握的信息很少。

相关问题