如果一个日期字符串"2005-06-09"如何传化成Date类型

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

我自己想了一个办法 但总觉的太麻烦了  
  大家帮我想想办法啊

· 网友精彩回答:

发表者:free_card

string   date="2005-05-20   11:20:00";  
  simpledateformat   myfmt=new   simpledateformat("yyyy-mm-dd   hh:mm:ss");  
  try{  
          date   newdate=myfmt.parse(date);  
          return   newdate;  
      }catch(exception   e){  
          e.printstacktrace();  
          return   null;  
      }  
 

发表者:runningboy007

data.valueof("2005-06-09");  
  在jsp中我是这么做的,可以完成。

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved