Java tutorial
//package com.java2s; //License from project: Apache License import android.text.TextUtils; public class Main { /** * 2016-01-23 10:00:12.0 => 2016-01-23 * @param str * @return */ public static String formatCreateDate(String createDate) { String result = ""; if (!TextUtils.isEmpty(createDate) && createDate.length() >= 10) { result = createDate.substring(0, 10); } return result; } }