Automatic date change

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • gaboi
    Private First Class

    • Mar 2006
    • 7

    Automatic date change

    I don't know what to use or how to go about having the date change automatically on a web page each day with the current date. Any help will be appreciated.
  • Watdaflip
    Major General

    • Sep 2005
    • 2116

    #2
    Re: Automatic date change

    This code below will show the current date each time the page loads (its not dynamic, if will only update on page loads)

    <?
    echo date('F j Y');
    ?>

    Just make sure your webpages are .php, or put those 3 lines into a .php file, and use an iframe where you want it at.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

    Comment

    • gaboi
      Private First Class

      • Mar 2006
      • 7

      #3
      Re: Automatic date change

      Thanks for the script. I really appreciate it.

      Comment

      • Carl II
        Sergeant

        • Jun 2006
        • 23

        #4
        Re: Automatic date change

        Doing a search on the forum I found the date-thing I was looking for fast & easy. Great! But... being a beginner, working on my first site, I haven't got a clue how to use the script mentioned. Tried a HTML box, but that didnt work. Is there someone out there that can tell (idiotproof) how to apply it :)

        Thanks

        Comment

        • heimy52
          Private First Class

          • Apr 2008
          • 5

          #5
          Re: Automatic date change

          Firstly, I am using BlueVoda Version 9.1.0. I was wondering if this info is still correct about the "changing date".
          Also, like the poster above, I don't know much. Are BlueVoda pages .php? and where and how do I post this code (I also couldn't tell where the code started or ended in the response! Pitiful, I know.) if they are not .php. Am I correct in interpreting the response as putting the code into an Inline frame?
          I am hoping to get the date to look like this - Sunday, June 22, 2008 (taken from a friend's web page that he used Dream Weaver to assemble).
          Thanks for any help. Paul

          Comment

          • Watdaflip
            Major General

            • Sep 2005
            • 2116

            #6
            Re: Automatic date change

            Use
            PHP Code:
            <?
            echo date('l, F j, Y');
            ?>
            Just insert it into a html box, and in your properties make sure .php is selected instead of html.

            Register/Login Script
            Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

            Comment

            • heimy52
              Private First Class

              • Apr 2008
              • 5

              #7
              Re: Automatic date change

              Thanks - Paul

              Comment

              • RichardM
                First Sergeant

                • Dec 2006
                • 82

                #8
                Re: Automatic date change

                Can i change the color and font size in this script?
                Thank you
                Richard

                Comment

                • Watdaflip
                  Major General

                  • Sep 2005
                  • 2116

                  #9
                  Re: Automatic date change

                  It just required html formatting. You just change it to

                  <?
                  echo '<span style="color: #000000; font-size: 12pt;">'.date('l, F j, Y').'</span>';
                  ?>

                  Where the red text is a hex color value, and the blue is the font size, the units can be in any of the normal types (pt, px, em, etc).

                  Register/Login Script
                  Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

                  Comment

                  • angelad
                    Private First Class

                    • Apr 2009
                    • 5

                    #10
                    Re: Automatic date change

                    Originally posted by RichardM View Post
                    Can i change the color and font size in this script?
                    Thank you
                    Richard
                    There is a script somewhere, semi-automated, which has a larger base of fonts and colors. I will try to find it and post it.

                    Comment

                    • stevevale
                      Private

                      • Jul 2009
                      • 1

                      #11
                      Re: Automatic date change

                      Originally posted by Watdaflip View Post
                      It just required html formatting. You just change it to

                      <?
                      echo '<span style="color: #000000; font-size: 12pt;">'.date('l, F j, Y').'</span>';
                      ?>

                      Where the red text is a hex color value, and the blue is the font size, the units can be in any of the normal types (pt, px, em, etc).
                      Thank you this has been most helpful
                      One further question can I have a date in the future appear as well?
                      Say I have a time limited offer for 10 days
                      I would have today's date on the site-4th July-but then in the text on the page I would want to say the offer expires at midnight 14th July how would I do that please.

                      Thank You
                      Steve Vale

                      Comment

                      • Watdaflip
                        Major General

                        • Sep 2005
                        • 2116

                        #12
                        Re: Automatic date change

                        Yes, you can have it display a game in the future, but can you explain more details of what you are trying to do.

                        By that I mean, are you wanting there to be a "limited 10 day offer" that is infact unlimited, and it will always update the expiration date to be 10 days ahead of time? Or do you just it to always print the 14th even on the 5th, 6th, 7th, etc?

                        If its the first case you will just need to change this part of the code posted above

                        date('l, F j, Y')

                        to be

                        date('l, F j, Y', time()+timestamp)

                        replacing the red word "timestamp", with the numeric value of the time in the future, in seconds. So if you want it to always display one day ahead, you would enter the value for one day in seconds ( 60 * 60 * 24 = 86400)

                        so for that it woul be

                        date('l, F j, Y', time()+86400)

                        10 days is 864000

                        Register/Login Script
                        Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

                        Comment

                        Working...
                        X