anyone know how to convert the following string to Date?
"Fri Jul 30 16:19:36 GMT+02.00 2021"
i tried:
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy");
try {String temp = value2[i].trim();
expiry = formatter.parse(temp);
} catch (Exception e) {
e.printStackTrace();
}
but,it doesn't work.
z expects the format GMT+02:00 not GMT+02.00 replace the . and it should work.
Worked for me with the following code:
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy");
try {
String temp = "Fri Jul 30 16:19:36 GMT+02:00 2021";
Date expiry = formatter.parse(temp);
} catch (Exception e) {
e.printStackTrace();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With