105 users online (0 members and 105 guests)  




  Results 1 to 7 of 7
Digg button stumble

Related

  1. Adding a date    Forum: Website Scripts Forum
    Replies: 1
  2. Getting todays date with javascript    Forum: Javascript Forum
    Replies: 3
  3. HTML codes - new website    Forum: HTML Forum
    Replies: 2
  4. Date Validation    Forum: HTML Forum
    Replies: 7
  5. Hide HTML Codes??    Forum: HTML Forum
    Replies: 2
  1. #1
    ShareInfo's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Oct 2001
    Location
    Charleston, SC
    Posts
    40

    Question HTML codes for todays date??

    Hi friends..

    I am creating a newsletter in HTML..
    One of the features I wanted in the newsletter was to display the actual day when person x subscribed my new newsletter.. well get the date to be dynamic..

    Just wanted to check out if there is a way to write a HTML code that will do this for me..

    I know that I can use JAVA and DHTML.. but if it's possible in HTML then I will use HTML..

    Well ... let me know..

    Greetings ShareInfo



  • #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hiya SI, how are ya?

    Two (easy) ways without getting involved in php etc -

    JavaScript -

    Code:
    <script language="JavaScript">
    <!--
    date=Date()
    document.write(date)
    //-->
    </script>
    The other way is with a Server Side Include, but to be honest, if the end result is to be an email, then you won't want to use this.

    Does the JS do the job?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  • #3
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    I hate JavaScript and dates, but if your using JS, I spun this one off another script(cut some of the other uneeded parts of the script out) while looking how to custimize JS dates:

    Code:
    <html>
    <head>
    <script language="JavaScript">
    function mdy(todaysdate) {
    //calls the function mdy why to get our date
    return todaysdate.getMonth()+1+"/"+todaysdate.getDate()+"/"+todaysdate.getYear()
    }
    </script>
    </head>
    <body>
    <script language="JavaScript">
    sampleDate1=new Date()
    document.write ("Today's date is "+ mdy(sampleDate1))
    </script>
    </body>
    </html>

  • #4
    ShareInfo's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Oct 2001
    Location
    Charleston, SC
    Posts
    40

    thanks

    Hi friends...

    Thanks..

    I tried cut and paste into my email with these suggestions .. but can't get the date to show up..

    All HTML coding works great and comes out the way I want it.. but it's giving me a hard time when I use JavaScript..

    That's why I wondered if there was a way to make a dynamic date with only HTML..

    I'll keep looking around to see if I can find a way to work around my little problem.. I can of course write in the date manually.. but hey u have to give yourself some problems that activate your brain.. lol..

    Greetings .. ShareInfo

  • #5
    benzden's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2002
    Location
    San Antonio, Texas
    Posts
    652
    HTML doesn't do anything but format and display data and images. You'll have to use javascript (or something else) to manipulate data.

    When having problems with javascript, make what you're trying to do an entirely separate file with nothing else in it except the standard, minimal <HTML><HEAD><TITLE>... tags. Then, once that's working, paste the javascript code into another HTML file. I just had a problem fixed that way this morning - the problem was that I'd typed a } instead of { in a couple places.

  • #6
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    lets see... if you can't get JS to work the only other way I know is PHP:

    PHP Code:
    <?php

    $thedate 
    date("F d, Y");
    /*(March 25, 2002)*/

    mail("mailingaddress@mail.com""Your Subject""
    Name: 
    $name\n
    Date: 
    $thedate\n
    Message: 
    $message\n""From: $Email\nReply-To: $Email\n");

    echo 
    "The mail was sent.";

    ?>
    Probably not what your using but do you get the idea of how you'd use the PHP version? If you can't get the JS version to work something like this should.

  • #7
    ShareInfo's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Oct 2001
    Location
    Charleston, SC
    Posts
    40

    Thanks

    ..Thanks to all of you..

    I was aware of the problems you mention benzden..

    So I tried out with creating just a test web site ... and send test emails.. the test web site turned out as I wanted it.. but seems like when I set it up in the autoresponder... it will not accept it so my test mails was blank.. so until I find a solution I will just work around it..

    It was ok to tried it out.. and it will just be in my welcome newsletter were it will be a 'problem'...

    Have a great day..


    Greetings.... ShareInfo



  • Tags for this Thread

    Posting Permissions

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