Long 轉date
Date result = new Date(param*1000);
Long 轉String
String result = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(param* 1000));
String轉date
Date result = new DateTime(param).toDate();
String轉Long
Long result = Long.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(param).getTime() / 1000);
Date轉String
String result = new SimpleDateFormat("yyyyMMddHHmmss").format(param);
String result = new DateTime(param).toString("yyyy-MM-dd HH:mm:ss");
Date轉Long
Long result = Long.valueOf(param.getTime() / 1000);
//獲取昨天零點的時間
Calendar calendar = Calendar.getInstance();
calendar.set(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)-1,0,0,0);
long StatisDate1 = calendar.getTime().getTime()/1000;
Date StatisDate2 = new Date(StatisDate1*1000);