2
votes

How to parse "Tue Jun 05 00:00:00 GMT+05:30 2012" text to Date in Java? I have used format "EEE MMM dd HH:mm:ss z yyyy" But not working.

1
too much text and less code..Simon Dorociak
But not working is not efficient to find out whats the problem here. Do share some code so that one can find out what is not workingAsif

1 Answers

0
votes

The trick that you may have missed is that you must set the locale because "Tue" or "Jun" can only be understood in English.

This works :

        SimpleDateFormat ft = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
        Date dt = ft.parse("Tue Jun 05 00:00:00 GMT+05:30 2012");