publicstatic String getTimeBySecond(String time){if(!"".equals(time)&&null!= time){
int str = Integer.parseInt(time);
int day = str /(24*60*60);
int hour = str %(24*60*60)/(60*60);
int min = str %(24*60*60)%(60*60)/60;
int second = str %(24*60*60)%(60*60)%60;
String h = String.valueOf(hour);
String m = String.valueOf(min);
String s = String.valueOf(second);
String resday ="";if(day<=0){
resday="";}else{
resday=day+"day,";}if(hour >=0&& hour <10){
h ="0"+ hour;}if(min >=0&& min <10){
m ="0"+ min;}if(second >=0&& second <10){
s ="0"+ second;}return resday + h +":"+ m +":"+ s;}returnnull;}
获取上个月的时间
publicstatic String getLastMonth(String time){
SimpleDateFormat format =newSimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c = Calendar.getInstance();try{
c.setTime(format.parse(time));}catch(ParseException e){
e.printStackTrace();}
c.add(Calendar.MONTH,-1);
Date m = c.getTime();
String mon = format.format(m);return mon;}