private static Map<String, String> getTime(String period) {
Map<String, String> timeRange = new HashMap<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
Calendar calendar = Calendar.getInstance();
timeRange.put("endTime", simpleDateFormat.format(calendar.getTime()));
switch (period) {
case "week": {
calendar.add(Calendar.DATE, -7);
}
break;
case "month": {
calendar.add(Calendar.MONTH, -1);
}
break;
default: break;
}
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
timeRange.put("startTime", simpleDateFormat.format(calendar.getTime()));
return timeRange;
}