Forum Moderators: coopster

Message Too Old, No Replies

countdown using filemtime?

         

Hitman3266

2:53 am on Dec 30, 2011 (gmt 0)

10+ Year Member



I have a file that gets updated every 60 minutes.

i would like to create a countdown till the next update (next update in XX minutes), by comparing the filemtime, to the current time..


im getting confused with the logic required to do this..and if its even possible..

Dinkar

7:53 am on Dec 30, 2011 (gmt 0)

10+ Year Member



Next Update Time = Current File Created Time + 60 Minutes

Count Down = Next Update Time - Current Time

Dinkar

10:35 am on Dec 30, 2011 (gmt 0)

10+ Year Member



well, you may also try this:

Count Down = 60 - (Current Time - Current File Created Time)

Hitman3266

2:16 am on Dec 31, 2011 (gmt 0)

10+ Year Member



how do i convert from unix time stamp to something readable?

$file = "blah.txt";
$nextup = filemtime($file) + 3600;
$count = $nextup - time() ;


im not sure how to go about this

coopster

6:14 pm on Jan 2, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can use the strftime() function:
[php.net...]