Announcement

Collapse
No announcement yet.

Inserting a "date and time"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inserting a "date and time"

    Is there a way to display the current date and time on my home page?

    Peter

    MusicGrams4U.com

  • #2
    Re: Inserting a "date and time"

    Your homepage needs to be made into a php page.

    Create a html box and insert the code below

    <?=date('F j Y g:i A')?>


    If you want to change the date and time formatting visit

    for a complete list of formatting options

    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


    • #3
      Re: Inserting a &quot;date and time&quot;

      Originally posted by Watdaflip View Post
      Your homepage needs to be made into a php page.

      Create a html box and insert the code below

      <?=date('F j Y g:i A')?>


      If you want to change the date and time formatting visit

      for a complete list of formatting options
      Hi watdaflip, is there a way to have this code not work on the server time. It shows a 6 hour time dif in the UK.

      Thanks.
      Regards Chris.

      Collectables, Collecting, collectors-info.com

      www.chrismorris.co.uk

      House build project

      Comment


      • #4
        Re: Inserting a &quot;date and time&quot;

        Umm, I am not aware of a built in function, I believe you have to do

        <?=date('F j Y g:i A', time()+(3600*6))?>

        The format being
        <?=date('F j Y g:i A', time()[+ or -](3600*[hours to add or subtract]))?>

        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


        • #5
          Re: Inserting a &quot;date and time&quot;

          This was perfect <?=date('F j Y g:i A', time()+(3600*6))?> & is a nice 7.15am in the uk. I will have a look through the site you left a link to, to see if there is anything about the hour we loose for winter & summertime savings in the UK.
          Must admit i am not sure if other contrys have this or not.


          Cheers.
          Regards Chris.

          Collectables, Collecting, collectors-info.com

          www.chrismorris.co.uk

          House build project

          Comment


          • #6
            Re: Inserting a &quot;date and time&quot;

            You can tell if the current day is daylight savings by doing this

            if(date('I'))
            {
            // The time is daylights saving
            }
            else
            {
            // The time is normal
            }

            And adjust the date accordingly. I believe the time adjustment will different depending if you are in the north or south hemisphere. But all you would have to do is and place it in the if else statement above

            <?=date('F j Y g:i A', time()+(3600*(6+ or - 1)))?>

            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