Jump to content


Photo

Show Time Difference Bet Now And Another Auto Updated


  • Please log in to reply
6 replies to this topic

#1 Manhag

Manhag

    Member

  • Members
  • PipPip
  • 27 posts

Posted 21 November 2012 - 06:52 PM

hello

this code shows time differnce bet 2 times in minutes
$to_time = strtotime("2012-12-13 10:42:00");
$from_time = strtotime(now);
echo round(abs($to_time - $from_time) / 60,2). " minute";

can it be auto updated ?


thanks :)

#2 Pikachu2000

Pikachu2000

    I hate everything.

  • Staff Alumni
  • 11,378 posts
  • LocationFuture Independent Republic of Texas
  • Age:106

Posted 21 November 2012 - 07:09 PM

Can what be auto updated? Where?
"Java" is to "Javascript" about the same as "fun" is to "funeral".

Why $_SERVER['PHP_SELF'] is bad. || Why ORDER BY RAND() is bad || Every problem can be solved with rm -rf *

Random Quote: "

#3 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,322 posts
  • LocationWA

Posted 21 November 2012 - 07:42 PM

Refresh the page.

#4 JohnTipperton

JohnTipperton

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts

Posted 21 November 2012 - 08:17 PM

you need to use AJAX to be able to auto update it try this link http://stackoverflow.com/questions/8197487/javascript-auto-update
{advertisement removed by staff}

#5 Manhag

Manhag

    Member

  • Members
  • PipPip
  • 27 posts

Posted 21 November 2012 - 08:59 PM

you need to use AJAX to be able to auto update it try this link http://stackoverflow...ipt-auto-update


thanks :)

could u please help me to use that code ?? :)

#6 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 22 November 2012 - 08:27 PM

No need to use AJAX, a simple JS interval is enough.
Keeping it simple.

#7 JohnTipperton

JohnTipperton

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts

Posted 26 November 2012 - 08:23 PM

you can also use meta to refresh the page.
<meta http-equiv="refresh" content="10">
{advertisement removed by staff}




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com