Java Code Examples for java.util.Date.toLocaleString()

The following are Jave code examples for showing how to use toLocaleString() of the java.util.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: androidgithub   File: Utils.java   View Source Code Vote up 5 votes
/**
 * Github时间字符串格式化
 *
 * @param githubTime 2017-10-13T08:11:48Z
 * @return 时间字符串
 */
public static String formatDateGithub(String githubTime) {
    githubTime = githubTime.replace("Z", " UTC");
    try {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss Z");
        Date date = formatter.parse(githubTime);
        return date.toLocaleString();
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 2
Project: MiPushFramework   File: ParseUtils.java   View Source Code Vote up 4 votes
private static String parseDate (Date date) {
    return date.toLocaleString();
}