1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto updating

Discussion in 'HTML & JavaScript' started by SupremeDev, Jul 18, 2012.

  1. SupremeDev

    SupremeDev Junior Member

    Joined:
    Jun 14, 2012
    Messages:
    183
    Likes Received:
    81
    Location:
    Planet Neptune
    Okay, so I have an HTML and CSS based site.
    In my site, updating the dates daily for latest updates is highly required to keep the visitors convinced.
    So, for example, today is the 18th of July, 2012, I have a column in my site where it consists "Update: 18th of July, 2012".

    Now, here's the situation. I'm going for a vacation for like 2 weeks to a place with little to no internet ( an island exactly ) and it's impossible for myself to manually change the updating dates on my site since I won't be able to access my cPanel. My question, is there anyway for my site to keep updating the dates automatically?

    So, basically, I want it like this. It should automatically update the column where it says "Update: *the current date*" to the current date. I hope you all got my question.
    If there is a way, I need it ASAP since I'm going on vacation tomorrow morning.
     
  2. SupremeDev

    SupremeDev Junior Member

    Joined:
    Jun 14, 2012
    Messages:
    183
    Likes Received:
    81
    Location:
    Planet Neptune
    Anyone? I'm sorry, but I really need it by today asap if it actually exists.If anything, at least tell me if something like that exists or not. Thanks!
     
  3. sockpuppet

    sockpuppet Junior Member

    Joined:
    Nov 7, 2011
    Messages:
    155
    Likes Received:
    145
    php version:
    PHP:
    <?php echo "Update: ".date("jS \of F, Y"?>
    javascript version:
    Code:
    <script type="text/javascript" src="https://raw.github.com/timrwood/moment/1.6.2/min/moment.min.js" ></script>
    <script>
    document.write('Update: '+moment().format('Do [of] MMMM, YYYY') );
    </script>
    
     
    • Thanks Thanks x 2
  4. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    I created a jsFiddle with the functionality you want: - deprecated -

    You 'll have to adjust it to your page.
    ----

    Edit: sockpuppet 's version is copy/pastable, so use that :)
     
  5. SupremeDev

    SupremeDev Junior Member

    Joined:
    Jun 14, 2012
    Messages:
    183
    Likes Received:
    81
    Location:
    Planet Neptune
    I'd like to thank all of you for the help, especially sockpuppet for the code.
    Because of this, my vacation was enjoyable without having to think about updates and such.