0
    //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

可以看到 Time 部分发生了变化。

4

0 回答 0