Android examples for java.util:Date Format
get Day value from date string in yyyy-MM-dd format
import android.support.annotation.Nullable; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main{ /**/*from w w w. ja v a2 s .c o m*/ * @param date {"yyyy-MM-dd"} * @return */ public static String getDay(@Nullable String date) { if (date == null) { return null; } return date.substring(8, 10); } }