LiveUtils.java
775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.cnlive.mz.live;
import java.util.Calendar;
/**
* 当前项目公共类
*
* @author liujicheng
*
*/
public class LiveUtils {
public static String SESSION_KEY_NAME = "userName";
public static String SESSION_KEY_ID = "userId";
public static String SESSION_ROLE_ID = "roleId";
public static void main(String[] args) {
String s = new LiveUtils().getRecentMonths();
System.out.println(s);
}
public static String getRecentMonths() {
int month = Calendar.getInstance().get(Calendar.MONTH);
StringBuffer sb = new StringBuffer();
if (month < 12) {
month = month + 1;
}
for (int i = 1; i <= month; i++) {
String m = "'" + i + "月" + "'";
sb.append(m);
if (i != month) {
sb.append(",");
}
}
return sb.toString();
}
}