Showing
2 changed files
with
16 additions
and
1 deletions
@@ -11,6 +11,10 @@ public final class DateUtils { | @@ -11,6 +11,10 @@ public final class DateUtils { | ||
11 | public final static String DEFAULT_FOMARTPATTER="yyyy-MM-dd HH:mm:ss"; | 11 | public final static String DEFAULT_FOMARTPATTER="yyyy-MM-dd HH:mm:ss"; |
12 | 12 | ||
13 | public final static String DAY_FOMARTPATTER="yyyy-MM-dd"; | 13 | public final static String DAY_FOMARTPATTER="yyyy-MM-dd"; |
14 | + | ||
15 | + public final static String ACTIVITY_DAY_FOMARTPATTER="yyyy/MM/dd HH:mm"; | ||
16 | + | ||
17 | + | ||
14 | 18 | ||
15 | 19 | ||
16 | /** | 20 | /** |
@@ -146,4 +150,15 @@ public final class DateUtils { | @@ -146,4 +150,15 @@ public final class DateUtils { | ||
146 | public static void main(String[] args) { | 150 | public static void main(String[] args) { |
147 | System.out.println(getTodayZero()); | 151 | System.out.println(getTodayZero()); |
148 | } | 152 | } |
153 | + | ||
154 | + /** | ||
155 | + * 将数据库中的UNIX_Time(该时间是距离1970年的秒数,在转换过程中先要换算成毫秒)转换成UTC时间 | ||
156 | + * @param time | ||
157 | + * @return | ||
158 | + */ | ||
159 | + public static String getActivityDateString(int time) | ||
160 | + { | ||
161 | + SimpleDateFormat sdf=new SimpleDateFormat(ACTIVITY_DAY_FOMARTPATTER); | ||
162 | + return sdf.format(new Date((long)time*1000)); | ||
163 | + } | ||
149 | } | 164 | } |
@@ -178,7 +178,7 @@ public class BrandActivityServiceImpl implements IBrandActivityService { | @@ -178,7 +178,7 @@ public class BrandActivityServiceImpl implements IBrandActivityService { | ||
178 | } | 178 | } |
179 | List<ActNewBrandResult> results = actNewBrandResultMapper.selectListByUid(uid); | 179 | List<ActNewBrandResult> results = actNewBrandResultMapper.selectListByUid(uid); |
180 | for (ActNewBrandResult result : results) { | 180 | for (ActNewBrandResult result : results) { |
181 | - result.setCreateTimeStr(result.getCreateTime() == null || result.getCreateTime() == 0 ? "" : DateUtils.getDateString(result.getCreateTime())); | 181 | + result.setCreateTimeStr(result.getCreateTime() == null || result.getCreateTime() == 0 ? "" : DateUtils.getActivityDateString(result.getCreateTime())); |
182 | } | 182 | } |
183 | apiRespons = new ApiResponse(200, "用户抽奖记录"); | 183 | apiRespons = new ApiResponse(200, "用户抽奖记录"); |
184 | apiRespons.setData(results); | 184 | apiRespons.setData(results); |
-
Please register or login to post a comment