/**
* 将字符串转换成一个List数组 2012-1-5,Xgw123485
*/
public static List<String> string2List(String str, String sign)
{
String[] temps = str.split(sign);
List<String> valueList = new ArrayList<String>(2);
for (String temp : temps)
{
valueList.add(temp.trim());
}
return valueList;
}
/**
* 将Date对象转化成字符串,由于SimpleDateFormat 多线程不安全,需要同步 2012-1-5,Xgw123485
*/
public static String dateFormatString(Date date)
{
DateFormat format = new SimpleDateFormat(df);
String returnDate = null;
returnDate = format.format(date);
return returnDate;
}
/**
* 将Date对象转化成字符串,格式YYYYMMDDHH24MISS 2012-1-5,Xgw123485
*/
public static String getNormalString()
{
DateFormat normalDF = new SimpleDateFormat("yyyyMMddHHmmss");
return normalDF.format(new Date());
}
/**
* 将Date对象转化成字符串,格式YYYYMMDD 2012-1-5,Xgw123485
*/
public static String getDateString()
{
DateFormat normalDF = new SimpleDateFormat("yyyyMMdd");
return normalDF.format(new Date());
}
public static String getMMDD(Date rep_date)
{
// 取到相应的消息时间中的日月,作为数据库的分区,格式 MMDD
Calendar rsp_cal = Calendar.getInstance();
rsp_cal.setTime(rep_date);
int day = rsp_cal.get(Calendar.DAY_OF_MONTH);
int month = rsp_cal.get(Calendar.MONTH) + 1;
String partition_id = null;
if (month < 10)
{
partition_id = "0" + month;
}
else
{
partition_id = String.valueOf(month);
}
if (day < 10)
{
partition_id += "0" + day;
}
else
{
partition_id += String.valueOf(day);
}
return partition_id;
}
public static int getSn()
{
return sn;
}
public static void setSn(int sn)
{
Tools.sn = sn;
}
public static int getSeq_id()
{
return seq_id;
}
public static void setSeq_id(int seq_id)
{
Tools.seq_id = seq_id;
}
public static Logger getLogger()
{
return logger;
}
public static void setLogger(Logger logger)
{
Tools.logger = logger;
}
public static int getMaxLength()
{
return maxLength;
}
* 将字符串转换成一个List数组 2012-1-5,Xgw123485
*/
public static List<String> string2List(String str, String sign)
{
String[] temps = str.split(sign);
List<String> valueList = new ArrayList<String>(2);
for (String temp : temps)
{
valueList.add(temp.trim());
}
return valueList;
}
/**
* 将Date对象转化成字符串,由于SimpleDateFormat 多线程不安全,需要同步 2012-1-5,Xgw123485
*/
public static String dateFormatString(Date date)
{
DateFormat format = new SimpleDateFormat(df);
String returnDate = null;
returnDate = format.format(date);
return returnDate;
}
/**
* 将Date对象转化成字符串,格式YYYYMMDDHH24MISS 2012-1-5,Xgw123485
*/
public static String getNormalString()
{
DateFormat normalDF = new SimpleDateFormat("yyyyMMddHHmmss");
return normalDF.format(new Date());
}
/**
* 将Date对象转化成字符串,格式YYYYMMDD 2012-1-5,Xgw123485
*/
public static String getDateString()
{
DateFormat normalDF = new SimpleDateFormat("yyyyMMdd");
return normalDF.format(new Date());
}
public static String getMMDD(Date rep_date)
{
// 取到相应的消息时间中的日月,作为数据库的分区,格式 MMDD
Calendar rsp_cal = Calendar.getInstance();
rsp_cal.setTime(rep_date);
int day = rsp_cal.get(Calendar.DAY_OF_MONTH);
int month = rsp_cal.get(Calendar.MONTH) + 1;
String partition_id = null;
if (month < 10)
{
partition_id = "0" + month;
}
else
{
partition_id = String.valueOf(month);
}
if (day < 10)
{
partition_id += "0" + day;
}
else
{
partition_id += String.valueOf(day);
}
return partition_id;
}
public static int getSn()
{
return sn;
}
public static void setSn(int sn)
{
Tools.sn = sn;
}
public static int getSeq_id()
{
return seq_id;
}
public static void setSeq_id(int seq_id)
{
Tools.seq_id = seq_id;
}
public static Logger getLogger()
{
return logger;
}
public static void setLogger(Logger logger)
{
Tools.logger = logger;
}
public static int getMaxLength()
{
return maxLength;
}