<script> function echeck_tdate(odate,edate){ var checkArray= new Array() ; var echeckArray= new Array() ; //nowArray = odate.split(" "); checkArray = odate.split("-"); checkDate = new Date(checkArray[0],checkArray[1],checkArray[2]);
echeckArray = edate.split("-"); echeckDate = new Date(echeckArray[0],echeckArray[1],echeckArray[2]);
var thesecond = 24 * 60 * 60 *1000 ; var diffTime = (echeckDate - checkDate)/thesecond;//计算天数 if (diffTime<0) { myreturn = '过期'; // } else if (diffTime==0) { myreturn = '今天'; } else { myreturn = '剩于'+diffTime+'天'; } //alert(myreturn); document.write(''+myreturn+'') } </script>
模板中 <script>echeck_tdate('2008-12-25','2008-12-28')</script>
|