取得当前时间的函数是DATE
<script language=JavaScript> <!-- var noon; var time=new Date(); var hour=time.getHours(); var minute=time.getMinutes(); var today=new Date; var week=new Array(7); week[0]="天"; week[1]="一"; week[2]="二"; week[3]="三"; week[4]="四"; week[5]="五"; week[6]="六"; if (hour<5) noon=""; if (hour>4 & hour<8) noon=""; if (hour>7 & hour<12) noon=""; if (hour==12) noon=""; if (hour>12 & hour<19) noon=""; if (hour>18 & hour<23) noon=""; if (hour>22) noon=""; if (hour>12) hour=hour-12; if (hour<10) hour="0"+hour; if (minute<10) minute="0"+minute; document.write("<span class='p9'>"); document.write(noon+" "+today.getYear()+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日 星期"+week[today.getDay()]); document.write("</span>");
//--> </script>
简单的还有:
<script language="JavaScript">document.write(Date());</script>
我试了四种方法:
executeSQL="insert into messboard(content,author,date) values( '"&b&"','"&a&"','"&now&"')"
executeSQL="insert into messboard(content,author,date) values( '"&b&"','"&a&"',"&now&")"
executeSQL="insert into messboard(content,author,date) values( '"&b&"','"&a&"','"&now()&"')"
executeSQL="insert into messboard(content,author,date) values( '"&b&"','"&a&"',"&now()&")"
都不对,再请教一下高手,感激啊!在线等
第二个和第四个肯定是不对
第一个和第三个要看本地系统时间格式对不对,还要看是什么数据库,是SQL Server数据库就可以
[此贴子已经被作者于2004-09-01 16:32:09编辑过]