2008年3月27日 星期四

java 的 DateFormat

//解析輸入日期 (轉換 MM/dd/yyyy 成 yyyy-MM-dd)
DateFormat formatIn = new SimpleDateFormat("MM/dd/yyyy");
DateFormat formatOut = new SimpleDateFormat("yyyy-MM-dd");
Date datefrom = formatIn.parse(from);
Date dateend = formatIn.parse(end);
formatedfrom = formatOut.format(datefrom);
formatedend = formatOut.format(dateend);

沒有留言: