How can I compare this timestamp format "20220708T0000Z" with current time and how can we update this timestamp to current time in same format in java, I have tried DateTimeFormatter and OffsetDateTime but both are not worked for me. Please help me. Here I am sharing my code:
private static final DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmssZ");
postEventInfoList.stream()
.filter
(e -> e.getPostEventTimestamp() == null ||
ZonedDateTime.parse(e.getActionTimestamp(),
[1]formatter).isAfter(ZonedDateTime.parse(e.getPostEventTimestamp(), formatter)))
.collect(Collectors.toList());
private void updatePostEventTimestamp(List<PostEventEntity> postEventInfoList) {
ZonedDateTime timestamp = ZonedDateTime.now();
postEventInfoList.forEach(pEvent -> {
pEvent.setPostEventTimestamp(timestamp.format(formatter));
});