首页天道酬勤string 转 date,java数组

string 转 date,java数组

张世龙 05-06 00:30 85次浏览

//*

publicstaticstringtimestampdate (stringtimestampstring,String format ) {

long timestamp=long.parse long (timestampstring ) * 1000;

string date=new Java.text.simple date format (format ).format (new Java.util.date ) timestamp );

返回日期;

}

//*

publicstaticintdatetoint (字符串,字符串格式)。

int time=0;

try {

simpledateformatsdf=newsimpledateformat;

datedate=SDF.parse (时间字符串;

String strTime=date.getTime () ';

strtime=strtime.substring (0,10 );

time=integer.parseint(strtime;

}

catch(parseexceptione ) {

e .打印堆栈跟踪(;

}

返回时间;

}

java char转int,javaint转string