Here you can find the source of dateToString(long date)
static String dateToString(long date)
//package com.java2s; //License from project: Apache License import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final ThreadLocal<Format> DATE_FORMAT = new ThreadLocal<Format>() { @Override/*from w ww.j a v a 2 s . c o m*/ protected Format initialValue() { return new SimpleDateFormat("yyyy-MM-dd hh:mm a"); } }; static String dateToString(long date) { return DATE_FORMAT.get().format(new Date(date)); } }