fork(6) download
  1. import java.time.Instant;
  2. import java.time.LocalDateTime;
  3. import java.time.ZoneId;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. String strDate = "2021-11-25";
  8. String strTime = "15:20";
  9. String strDateTime = strDate + "T" + strTime;
  10. LocalDateTime ldt = LocalDateTime.parse(strDateTime);
  11. Instant instant = ldt.atZone(ZoneId.systemDefault()).toInstant();
  12. System.out.println(instant);
  13. }
  14. }
Success #stdin #stdout 0.12s 52028KB
stdin
Standard input is empty
stdout
2021-11-25T15:20:00Z