Java中的long类型的秒数转成字符串

Java中的long类型的秒数转成字符串

    // published是时间lang值 比如:1419323634391
    public String getPublishedStringLong() {
        String pattern = "yyyy-MM-dd HH:mm:ss";
        SimpleDateFormat format = new SimpleDateFormat(pattern);
        return format.format(new Date(published));
    }
    
    public String getPublishedString() {
        String pattern = "yyyy-MM-dd";
        SimpleDateFormat format = new SimpleDateFormat(pattern);
        return format.format(new Date(published));
    }

你可能感兴趣的:(java)