0

I need converts an "yyyy-mm-dd hh:ss" (ie: Timestamp = 2015-01-28 14:16:02.0) to "yyyy/mm/dd hh:ss" but returning a Date (and not a String) because I'm changing a object attribute.

My code is above, but dont work for it. My "dtFormat" = 2015/01/28 14:16:02 GMT-03:00, but when I need back to a Date, I lost the format changing to Wed Jan 28 14:16:02 GMT-03:00 2015.

private final String dateTimeFormatSecondTimeZone = Util.DATE_TIME_FORMAT_SEC+" z";

    SimpleDateFormat df = new SimpleDateFormat(dateTimeFormatSecondTimeZone);
    String dtFormat = df.format(entity.getDateTime());
    Date dateChanged = df.parse(dtFormat);
    entity.setDateTime(dateChanged);
Helio Bentzen
  • 645
  • 2
  • 12
  • 24

0 Answers0