<script>
function CheckInfoDate(infodate){
var today=new Date().getTime();
var theday=Date.parse(infodate.replace(/(/d+)-(/d+)-(/d+)/,'$2/$3/$1'));
if(today>=theday)
document.write('已过期');
else
document.write('还剩'+Math.floor((theday-today)/(24*3600*1000))+'天');
}
CheckInfoDate('2017-08-14');
</script>
2017-08-14 换成 [!--过期时间字段--]
如:字段名:dqtime 字段标识:到期时间 字段类型:VARCHAR(100) 是
--------------------------------------------------------------------------
<script type="text/javascript">
<!--
function getDateFromString(strDate)
{
var arrYmd = strDate.split("-");;
var numYear = parseInt(arrYmd[0]);
var numMonth = parseInt(arrYmd[1]) - 1;
var numDay = parseInt(arrYmd[2]);
return new Date(numYear, numMonth, numDay);}
var datFrom = getDateFromString("2007-07-14");
var datTo = getDateFromString("2007-08-01");
var numDays = (datTo-datFrom)/(24*3600*1000);
document.write(numDays);//-->
</script>
2007-07-14 换成 [!--开始时间字段--]
2007-08-01 换成 [!--过期时间字段--]
如:字段名:dqtime 字段标识:到期时间 字段类型:VARCHAR(100) 是
新闻热点
疑难解答