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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2013
    Posts
    34
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Decrease time with javascript ?

    I have a variable get by php from table in database: $time, 06-10-2013 13:24:32
    I wan't to echo in browser a $time decreased automtically, 13:24:32, 13:24:31, 13:24:30 ...
    and when the time is time out, 00:00:00, the code will do some PHP functions.
    Hope you understand and help me
    Thanks in advanced.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    What is the point of this? Few people will visit your site for 13 hours.

    Why not simply perform the functions in PHP at 00:00:00?

    JavaScript cannot directly execute serverside code, since it runs on the client, but you could use AJAX to request a new page.

    Quizmaster: "Thar she blows" was the traditional cry when sailors spotted what creature?
    Contestant: The Loch Ness Monster
    Last edited by Philip M; 10-06-2013 at 11:36 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    May 2012
    Location
    France
    Posts
    224
    Thanks
    0
    Thanked 32 Times in 30 Posts
    You need, at first, a countdown ! Then see, for example, this Webdeveloper.com thread


  •  

    Posting Permissions

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