var dependedVal="2005-3-4"; //根据日期字符串转换成日期 var regEx = new RegExp("\\-","gi"); dependedVal=dependedVal.replace(regEx,"/"); //dependedVal=dependedVal.replace("\\-","/");//这样不行 alert(dependedVal) /
参考URL:http://www.busfly.net/csdn/post/java_string_fomat_date_time_simpledateformat.html 关键代码: java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); JAVA中各种日期表示字母如下: 字母 日期或时间元素 表示 示例 G Era 标志符 Text AD y 年 Year
参考URL:http://www.busfly.net/csdn/post/java_string_fomat_date_time_simpledateformat.html 关键代码: java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); JAVA中各种日期表示字母如下: 字母 日期或时间元素 表示 示例 G Era 标志符 Text AD y 年 Year