Java tutorial
//package com.java2s; import android.text.TextUtils; import android.util.Log; import org.joda.time.DateTime; import org.joda.time.format.ISODateTimeFormat; public class Main { public static DateTime formatDateFromStr(final String dateStr) { DateTime dateTime = new DateTime(); if (!TextUtils.isEmpty(dateStr)) { try { dateTime = DateTime.parse(dateStr, ISODateTimeFormat.dateTimeParser()); } catch (Exception e) { Log.i("Exception:", e.getMessage()); } } return dateTime; } }