3

I'm trying to convert this String to Date:

Tue Mar 01 11:46:32 CET 2016

this is the code I have:

DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
Date mTimeStamp = format.parse(getTimeStamp());

it throws a ParseExeption...

0

1 Answer 1

5

Your format is fine - your issue may be that your default locale is not English and the day and/or month names are not valid in your default language.

This should work as expected:

DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
Date mTimeStamp = format.parse("Tue Mar 01 11:46:32 CET 2016");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.