var dt = new Date(); // 客户端的时间
document.write(dt.getYear()+"-"+dt.getMonth()+"-"+dt.getDate());如果你要服务器的时间(php):<script>
var dt = "<?=date("Y-m-d")?>";
</script>

解决方案 »

  1.   

    你好,那如果是ASP里要获得服务器时间该怎么做?
      

  2.   

    txt.value=new Date.toLocaleString
      

  3.   

    shiliangdong(笑笑而过),能说详细点嘛?能帮我这句语句完成嘛?我是菜鸟,实在不知道该怎么写~~
    <SCRIPT>  
    function check(){
    var thedate="2006-12-17";
    ..........
    ..........
    ..........
    ..........
    </SCRIPT>
    我想知道正确的该怎么写,才能完全的顶替 2006-12-17 而变成系统自动获得当前日期.谢谢了!
      

  4.   

    <SCRIPT>  
    function check(){
    var thedate="<%=DateTime.Now.ToString("yyyy-MM-dd")%>"; //这个是服务器上当前时间
    ..........
    ..........
    ..........
    ..........
    </SCRIPT>