Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PHP Tutorials: Date and Time (Part 2)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
10,906
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 17, 2009

How to display the current time, a time in the past or present, and how to create a simple countdown script.

  • likes, 3 dislikes

Link to this comment:

Share to:

Uploader Comments (phpacademy)

  • i am a very new learner, and i am agree with Vincent0of0lara. Refreshing the page is not a good thing; there maybe people want to read something or watch, but the page refresh and avoid them.

    But it is a very good tutorial for a new learner, i alot of things thanks :)

  • @Aimal096 Glad you found it somewhat useful. I was refreshing the page just to demonstrate. Obviously this could not be embedded and used in actual content. It's simply a tutorial.

  • That's not really an expected answer. If you want to teach something and if somebody tells you what you are teaching is wrong, you simply should correct yout mistakes, instead of telling the guy who told you it's wrong not to care about it.

  • @vincent0of0lara I don't consider feedback to be "This Tutorial is the worst PHP-Tutorial I've ever seen.".

  • Are you serious?

    This Tutorial is the worst PHP-Tutorial I've ever seen.

    NEVER use date() for important projects. Use gmdate() and add the time.

    And never refresh the page every second for a countdown.

  • @vincent0of0lara Don't watch then.

Top Comments

  • you are my greatest php teacher..lol

    THANK YOU SO MUCH..

see all

All Comments (22)

Sign In or Sign Up now to post a comment!
  • Thanks for this!!

  • Thanks again!

  • it worked with no errors, but where does it get the time from cause right now at my house it is 6:55 but on the page it says 11:55.

  • @TheMASSTTER what is the and get aut supposed to be doing? is this all you wanted?

    $currenttime = date("h:i:s");

    $goaltime = date("22:45:00");

    echo "Current time is $currenttime Goal time is $goaltime";

  • @JayGeePee1

    (Late by 9 months to reply lmao)

    Put the refresh feature inside the if statement, that way if the goal is reached it will only refresh once :D

  • Er

    this isnt a countdown, nothing is counting down lol, -_-

  • i'am a noob in any php html skript and i tryed the program PHP editor i typrd in this :

    $currenttime = date ("H:i:s");

    $goaltime = "22:45:00"

    echo "currenttime $currenttime Goaltime $goaltime";

    and get aut:

    $currenttime = date ("H:i:s");

    $goaltime = "22:45:00"

    echo "currenttime $currenttime Goaltime $goaltime";

    any ides?

  • @phpacademy Maybee by putting it in a while loop would be better.

  • it is the same as date(d-m-y) if i count it?

  • Heres one question I have... Is there a way to stop the refresh feature when the goal is met?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more