Here you can find the source of getLatest7Day()
public static Map<String, Long[]> getLatest7Day()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.TreeMap; public class Main { public static Map<String, Long[]> getLatest7Day() { String todayStr = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); todayStr = sdf.format(new Date(System.currentTimeMillis())); todayStr = todayStr + " 00:00:00"; Date today = new Date(); DateFormat sdf2 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Map<String, Long[]> data = new TreeMap<>(); try {/*from w ww . ja v a 2 s . c o m*/ today = sdf2.parse(todayStr); long todaybegin = today.getTime(); data.put(new SimpleDateFormat("Mdd").format(todaybegin), new Long[] { todaybegin / 1000, System.currentTimeMillis() / 1000 }); for (int i = 1; i <= 6; i++) { data.put(new SimpleDateFormat("Mdd").format(new Date(todaybegin - 86400000 * i)), new Long[] { (todaybegin - 86400000 * i) / 1000, (todaybegin - 86400000 * i + 86539000) / 1000 }); } } catch (ParseException e) { } return data; } public static int getTime() { return (int) (System.currentTimeMillis() / 1000); } }