get Day value from date string in yyyy-MM-dd format - Android java.util

Android examples for java.util:Date Format

Description

get Day value from date string in yyyy-MM-dd format

Demo Code

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);
    }

}

Related Tutorials