Oktay Alizada Oktay Alizada - 20 days ago 5x
Java Question

Java date format - GMT +04:00

I have to parse the following date

Fri Sep 30 18:31:00 GMT+04:00 2016

and it is not working with the following pattern:

new SimpleDateFormat("EEE MMM dd HH:mm:ss z YYYY", Locale.ENGLISH);

Could you please tell me what I am doing wrong?


It should be lower case "y":

EEE MMM dd HH:mm:ss z yyyy

Upper case "Y" means weekBasedYear:

a date can be created from a week-based-year, week-of-year and day-of-week

I guess mixing the week-based and absolute/era patterns just does not work well for parsing.