Results 1 to 6 of 6

Thread: How to add date and time this code

  1. #1
    Join Date
    Nov 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to add date and time this code

    <td width="30%" valign="top"><b>Name:</b></td>
    <script language="javascript" src="/templates/js.tpl"></script>

    I want to add date and time near name


    which code I add;
    js.tpl(script) and top the td code.Please help

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <td width="30%" valign="top"><b>Name:</b><br>Date/Time: <script type="text/javascript">
    document.write(new Date().toLocaleString());
    </script></td>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi,
    thank you for messaj .the code is true.but I use in comment form.So the time is stop when comment send the users.But this code passing in comments

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm still a little vague on what you are after but, this works in a different sort of way and may provide a useful enough example for your purposes:

    HTML Code:
    <span>Name<br>Date/Time: <span id="dt"><script type="text/javascript">
    document.write(new Date().toLocaleString());
    </script></span><script type="text/javascript">
    setInterval("document.getElementById('dt').innerHTML=new Date().toLocaleString()", 1000);
    </script></span>
    It really boils down to: When do you want to capture the current date and time and where do you want that data sent?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2006
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry I don't want this code.Because the time is continuous refresh with this code.But I want the time is stop when comment is send like this ;


  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Then stop it or generate it to begin with at that point. I cannot be more specific without the code used to generate the comment in the first place. However, it looks like a server side package. So, it probably has a way to include the date/time stamp in the comment already. Read your documentation or post a question in a forum dedicated to that package.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •