如何从JSP中返回的(2003/2/10)中,在JAVASCRIPT中单独去出年,月,日!

如何从JSP中返回的(2003/2/10)中,在JAVASCRIPT中单独去出年,月,日!
---------------------------------------------------------------

1<script language="javascript">   
2var s = "2003/2/10";   
3var d = new Date(s);   
4alert(d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日");   
5</script>

---------------------------------------------------------------

1<script>   
2var str="2003/2/10";   
3var aDate = str.split("/");   
4alert("年:"+aDate[0]);   
5alert("月:"+aDate[1]);   
6alert("日:"+aDate[2]);   
7</script>
Published At
Categories with Web编程
comments powered by Disqus