Results 1 to 6 of 6

Thread: Inserting a "date and time"
      
   

  1. #1
    ptnfl is offline Staff Sergeant
    Join Date
    Feb 2007
    Posts
    43

    Default Inserting a "date and time"

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

    Peter

    MusicGrams4U.com

  2. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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
    http://us2.php.net/manual/en/function.date.php
    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

  3. #3
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default Re: Inserting a "date and time"

    Quote 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
    http://us2.php.net/manual/en/function.date.php
    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.

  4. #4
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: Inserting a "date and time"

    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

  5. #5
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default Re: Inserting a "date and time"

    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.

  6. #6
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: Inserting a "date and time"

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49