Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Write out current time PHP script



    Ok, first off, I must apologize...i have absolutely no idea where to begin here...i don't even know what to ask...so here's what I wanted to do and was trying to do...

    I wanted to show the "my webserver's actual time and date" on my webpage instead of showing the visitors' time and date which is what is usually done in most pages (like duh,...they already know that ) Anyhoo, so I found this script on this page:

    http://www.shearersoftware.com/softw...b-tools/clock/

    which is exactly what I had wanted (it would have been more cool if it was running the seconds off...) However, it was not as simple and easy as it seemed on the instructions: Copy & paste to text editor, re-position divs etc. Save as .PHP (uh-oh!) and upload to server...I know i'm missing something...BIG here...so what is it?? Coz it's not showing up the way I think it should unlike javascript or anything...not even close

    Thanks for any tips...do i need to install something???

    NewbieMe

  • #2
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    How is it showing up?

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    does your server have PHP installed ?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    If your site is set up with php the code below will display the year the server is set to. Check out a php book or the php manual for more time/date combonations.

    PHP Code:
    <?php

    echo date('Y');

    ?>
    Leonard Whistler
    www.stubby.ca
    Leonard Whistler

  • #5
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts
    Bear in mind that php is sever side so the time will not increment automatically without a page refresh. To have it continuously change you need to use javascript (client side)

  • #6
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Good point litebearer

    Instead of displaying the server time, which in my opinion is just as useless as displaying the user-computers time, I think it would be neat to be able to tap into the Atomic Clock and display the exact time of the earth.

    Leonard Whistler
    www.stubby.ca
    Leonard Whistler

  • #7
    New Coder
    Join Date
    Feb 2003
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by firepages
    does your server have PHP installed ?
    How would you know...if it has PHP installed? (aside from asking the guys that run it...)

    Quote Originally Posted by Error 404
    How is it showing up?
    When I uploaded the php script as instructed...and when I opened the webpage, it just automatically prompted a Save It As box....it doesn't show up actually...

  • #8
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,093
    Thanks
    11
    Thanked 101 Times in 99 Posts
    it just automatically prompted a Save It As box....
    which almost certainly means you do not have PHP available on the server , to be 100% sure though you need to ask, as you may have PHP as a CGI available or via some other extension rather than .php.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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