将当天时间转换为unix时间戳

/**
* @return
*
* @Title: getDate
* @Description: TODO(时间戳转换为String类型的日期数据)
* @param @param unixDate 设定文件
* @return void 返回类型
* @throws
*/
public static String getDate(String unixDate) {
String re_StrTime = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 例如:cc_time=1291778220
long lcc_time = Long.valueOf(unixDate);
re_StrTime = sdf.format(new Date(lcc_time * 1000L));
return re_StrTime;
}
/**
*
* @Title: getCurrentTimestamp
* @Description: TODO(当前时间时间戳)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
public static String getCurrentTimestamp(){
String time = System.currentTimeMillis()+"";
return getDate(time.substring(0, 10));
}
上一篇:SharDingJDBC-4.0.0-RC1按月水平分表


下一篇:Python之旅.第四章.模块与包 4.02