I get this field from kafka that use avro schema:
long dateTime = 1499070300000L; //value is just for example, but have to be micros
It has logicalType: "logical-timestamp-micros"
And I have this kind of Dto:
@JsonFormat(pattern = "dd.MM.yy HH:mm:ss")
private LocalDateTime time;
And I am trying to convert field dateTime to be currentDateTime field format:
long dateTime = 1499070300000L;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yy HH:mm:ss");
LocalDateTime localDateTime = LocalDateTime.parse(Instant.ofEpochMilli(dateTime)
.atZone(ZoneId.systemDefault())
.format(dateTimeFormatter));
But I am getting this error:
Exception in thread "main" java.time.format.DateTimeParseException: Text '03.07.17 11:25:00' could not be parsed at index 0
Where am I doing wrong?