문제

I've received this start_time from my facebook query:

2013-05-30T19:30:00+0300

how can i parse it to Date in Android ?

I've tried this:

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss' '");
도움이 되었습니까?

해결책

Use yyyy-MM-dd'T'HH:mm:ssZ format as below...

String dateString = "2013-05-30T19:30:00+0300";

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
Date date = dateFormat.parse(dateString);

dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
String formatedDate = dateFormat.format(date);

Log.d("Date", formatedDate);

Output:

03-10 18:29:47.074: D/Date(27257): 2013-05-30 10:30

다른 팁

Try out this link:

https://stackoverflow.com/a/13607418/3110609

You need to use SimpleDateFormat but need to manage correctly

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top