how do I automatically make the website show todays's date? or number?

Discussion in 'HTML & Website Design' started by shamrock36, Apr 15, 2009.

  1. #1
    Hi,
    How can I code a page in HTML ONLY, some function that would show a certain number, probably according to the server's date?

    for example, If I wanna create a page with a line that would say:

    "All Inquieries would be responded until 25th April.",
    if today's date is april 25th. and so on

    is it possible with some server side include maybe? I don't want the client to see that it is some sort of script in the source, but to see it as if it was a regular coded line....

    I'm not necessarily looking for a function that would list the date according to the user's own date, or that would also change the presentation of the month, like from March to April, because I don't know if its possible,
    so I'm ready to compromise with just having the number automatically bounce, in one number up, each day, according to the date in my Server

    hope you get what I mean, it was a little hard to explain.

    thanks!
     
    shamrock36, Apr 15, 2009 IP
  2. Astroman

    Astroman Well-Known Member

    Messages:
    2,355
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    135
    #2
    If you don't want them to see the code you will probably have to use PHP's 'echo date' or similar function.
     
    Astroman, Apr 15, 2009 IP
  3. James Barcellano

    James Barcellano Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Very easy to do in php.
     
    James Barcellano, Apr 15, 2009 IP
  4. sliver

    sliver Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it can be done also in javascript but it's impossible hiding the source
     
    sliver, Apr 15, 2009 IP
  5. shamrock36

    shamrock36 Active Member

    Messages:
    180
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    ok,
    I don't know exactly what php means and how it functions, I guess that my webhost support it as well though,
    I only have knowledge in html,
    and I would like to keep my pages in .html, since that's the way they are already showing in google,

    so is there nothing that can be done?

    and how could it be done without hiding the code?
     
    shamrock36, Apr 16, 2009 IP
  6. Astroman

    Astroman Well-Known Member

    Messages:
    2,355
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    135
    #6
    Astroman, Apr 16, 2009 IP
  7. ivalnaz

    ivalnaz Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    most popular to use is javascript
     
    ivalnaz, Apr 16, 2009 IP
  8. rogerbeta

    rogerbeta Well-Known Member

    Messages:
    174
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #8
    Live Date Script-
    Dynamic Drive (www.dynamicdrive.com
     
    rogerbeta, Apr 16, 2009 IP
  9. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #9
    if YOU have php SSI enabled on your html files
    then the php code below will do your job as well

    <?php $today = date("r T "); ?>
    <p>Last updated <?php echo $today ?></p>

    replace "Last updated" with whatever text you want displayed before or after your actual date

    a little research in google about the function date() will show you all variations to display date
    see also
    http://www.php.net/date

    else use any of the javascript mentioned already
     
    hans, Apr 16, 2009 IP