www.webdeveloper.com
Results 1 to 2 of 2

Thread: Show Text Per User's Time via PHP?

  1. #1
    Join Date
    Jun 2007
    Posts
    144

    Show Text Per User's Time via PHP?

    I would like to display certain text per the user's time. For instance, in the morning the text would say "Good Morning", after noon would say "Good Afternoon", after six would output "Good Evening" and so on.

    How can I do this easily via PHP?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,926
    You can only do it if you somehow get information from the user indicating what his/her local time zone is. This could be part of the user registration process if, in fact, users must register. Otherwise you would have to either use some JavaScript to get the local time info and let your script know somehow (AJAX?) or use some sort of IP-to-location database to make a best guess as to the user's location and time zone.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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
  •  
HTML5 Development Center



Recent Articles