fork(1) download
  1. import java.time.LocalDate;
  2. import java.time.OffsetDateTime;
  3. import java.time.ZoneId;
  4. import java.time.ZonedDateTime;
  5.  
  6. public class Main {
  7. public static void main(String[] args) {
  8. LocalDate today = LocalDate.now();
  9. // Note: Change the ZoneId as applicable e.g. ZoneId.of("Europe/London")
  10.  
  11. ZonedDateTime zdt = today.atStartOfDay().atZone(ZoneId.systemDefault());
  12. System.out.println(zdt);
  13.  
  14. OffsetDateTime odt = zdt.toOffsetDateTime();
  15. System.out.println(odt);
  16. }
  17. }
Success #stdin #stdout 0.07s 48616KB
stdin
Standard input is empty
stdout
2021-07-11T00:00Z[GMT]
2021-07-11T00:00Z