0

Date string1: 2022-10-30T04:45:00+00:00
Date string2: Oct 30, 2022 at 04:45 GMT

Date string1 and Date string2, i want formate is "yyyy/MM/dd HH:mm:ss"

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
YYC
  • 1
  • 1
  • 2
    Welcome to Stack Overflow. Please search before asking. – Ole V.V. Oct 30 '22 at 06:46
  • 2
    Only when you search, avoid any suggestions to use the old classes like `SimpleDateFormat` and `Date`. They were supplanted nearly 10 years ago by [java.time, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/). You will need classes `OffsetDateTime` and `DateTimeFormatter` and possibly more. – Ole V.V. Oct 30 '22 at 06:57
  • Your source strings include offset from UTC or GMT (zero in both your examples). Assuming that the offset may also be non-zero,in which time zone or at which offset do you want the result format? It will be a bad idea to retain the offset from the original string without telling the reader of the new string which it was. – Ole V.V. Oct 30 '22 at 07:00

0 Answers0