Long转换为date

public static void main(String[] args) {
		Long time = System.currentTimeMillis();
		System.out.println(time);

		System.out.println(transferLongToDate("yyyy-MM-dd HH:mm:ss",time));

	}

	private static String transferLongToDate(String dateFormat, Long millSec) {

		SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);

		Date date = new Date(millSec);

		return sdf.format(date);

	}

 

posted @ 2016-03-15 20:23  heyLuer  阅读(679)  评论(0编辑  收藏  举报