按天统计某企业访问不同城市不同页面的pv及uv
This commit is contained in:
+23
@@ -1,7 +1,10 @@
|
||||
package com.fangjia.job.common.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
@@ -72,6 +75,26 @@ public class DateUtilCustom {
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期格式化
|
||||
* @param date
|
||||
* @param pattern
|
||||
* @return
|
||||
*/
|
||||
public static String formatByPattern(Date date, String pattern) {
|
||||
if (date == null)
|
||||
return "";
|
||||
String result = "";
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||
result = format.format(date);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println(JsonUtils.toJson(getLatelyDate(3)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user