//createdAt and lastUpdatedAt are initialised like this:
LocalDateTime createdAt = LocalDateTime.now(ZoneId.of("UTC"));
LocalDateTime lastUpdatedAt = LocalDateTime.now(ZoneId.of("UTC"));
//Rest of the code...
System.out.println(rocReviewComment.getCreatedAt().toString() + ">>>" + rocReviewComment.getLastUpdatedAt().toString());
// Initialize the database
rocReviewCommentRepository.saveAndFlush(rocReviewComment);
System.out.println(rocReviewComment.getCreatedAt().toString() + ">>>" + rocReviewComment.getLastUpdatedAt().toString());
第一次打印:2021-02-22t16:16:14.755>>>2021-02-22t16:16:14.762
第二次打印:2021-02-22t10:46:44.389>>>2021-02-22t10:46:44.389
你可以看到时间部分被改变了。
暂无答案!
目前还没有任何答案,快来回答吧!