| 发表于:2007-02-09 11:49:576楼 得分:0 |
public static string getstring(string str) throws exception { simpledateformat df = new simpledateformat( "yyyy/mm/dd "); date date = df.parse(str) ; calendar ca =calendar.getinstance(); ca.settime(date); int year = ca.get(calendar.year); int day = ca.get(calendar.day_of_year); int century = (year/100)+1 -20 > =0 ? (year/100)+1 -20 : (year/100)+1; string year1 = year%100 > =10 ? integer.tostring(year%100) : "0 "+year%100; return century+year1+day; } 写了一个 自己试试 | | |
|