fork download
  1. import java.time.*;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. // Start date-time of the day in the system's time zone
  6. LocalDateTime ldt = LocalDate.now().atStartOfDay();
  7. System.out.println(ldt);
  8.  
  9. // Start date-time of the day in a given time zone
  10. ZoneId tz = ZoneId.of("Europe/London");
  11. ZonedDateTime zdt = LocalDate.now(tz).atStartOfDay(tz);
  12. System.out.println(LocalDate.now().atStartOfDay());
  13. }
  14. }
Success #stdin #stdout 0.15s 62524KB
stdin
Standard input is empty
stdout
2024-02-23T00:00
2024-02-23T00:00