DateTimeUtil 工具类,android 和 java 通用

 

import java.sql.Date;
import java.text.SimpleDateFormat;

public class DateTimeUtil {

    public final class FormatType {
        public static final String FULL = "yyyy:MM:dd HH:mm:ss:SSS";
        public static final String DATE = "yyyy:MM:dd";
        public static final String TIME = "HH:mm:ss:SSS";
    }

    public static String formatDateTime(Long date, String format) {
        return new SimpleDateFormat(format).format(new Date(date));
    }

    public static String formatCurrentTime(String format) {
        return formatDateTime(System.currentTimeMillis(), format);
    }

}

posted @ 2016-04-05 23:45  MarcoReus  阅读(272)  评论(0编辑  收藏  举报