调用示例:
//当前日期var tcur=showTime(0);//前一天var tqyt=showTime(-1);//后一天var thyt=showTime(1);
附,JS得到当前日期时间的小例子
function currentTime() { var d = new Date(); var vYear = d.getFullYear(); var vMon = d.getMonth() + 1; var vDay = d.getDate(); var h = d.getHours(); www.jquerycn.cn var m = d.getMinutes(); var se = d.getSeconds(); var s = vYear+"-"+ (vMon < 10 ? "0" + vMon : vMon)+"-" + (vDay < 10 ? "0" + vDay : vDay)+" " + (h < 10 ? "0" + h : h)+":" + (m < 10 ? "0" + m : m)+":" + (se < 10 ? "0" + se : se); return s;}