/**
* 活动当前时间
* 返回系统时间格式Thu May 14 15:33:08 CST 2015
*/
public static Date getNowDate() {
Date date = new Date();
return date;
* 时间格式转化
* 返回为字符串类型格式为2015-05-14 15:31:16
*/
public static String simpleFormat(Date date) {
* Date类型转long类型
* 返回时间的毫秒1431594984732
*/
public static long dateToLong(Date date) {
long longDate = date.getTime();
return longDate;
* 活动当前时间
* 返回系统时间格式Thu May 14 15:33:08 CST 2015
*/
public static Date getNowDate() {
Date date = new Date();
return date;
}
* 时间格式转化
* 返回为字符串类型格式为2015-05-14 15:31:16
*/
public static String simpleFormat(Date date) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String simpleDate=simpleDateFormat.format(date);
return simpleDate;}
* Date类型转long类型
* 返回时间的毫秒1431594984732
*/
public static long dateToLong(Date date) {
long longDate = date.getTime();
return longDate;
}
/**
* 获取某年某月的天数
*
*/
public static int getDayNum(String year,String month){
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM");
Calendar calendar=Calendar.getInstance();
try {
calendar.setTime(simpleDateFormat.parse(year+"-"+month));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int dayNum=calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
return dayNum;
}