1

我们如何从 XMLGregorianCalendar 中删除时间戳。我只需要在我的 JSON 中显示日期。我用过 mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS),但我仍然看到时间戳。

4

1 回答 1

-1
public String getCurrentDateWithoutTime(){
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String dateWithoutTime = sdf.format(new Date());
    return dateWithoutTime;
}
于 2018-03-29T19:18:17.857 回答