user1417302
user1417302

Reputation: 421

Android: String of date to Date format

I have a string : "2012-08-10" which represents : "yyyy-MM-dd"

I have tried to convert it to a date format using the following:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 
 Date convertedDate = dateFormat.parse(eventDates.get(i));

However the log gives the following types of dates:

Fri Aug 10 00:00:00 GMT+01:00 2012

What am I doing wrong?

Upvotes: 0

Views: 177

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240900

It is correct, your log uses its own representation of date, if you want the same format then you need to use

dateFormat.format(dateInstance);

Upvotes: 2

Related Questions