Forum Moderators: coopster

Message Too Old, No Replies

last modified with pHp

         

F8lsin

6:39 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



<?

$last_modified = filemtime("thepageyouwant.php");

print("Page Last Modified");
print(date("m/j/y h:i", $last_modified));

?>

I'm really new in php, so I want to ask, how I could do that to show something like that...
>> Page Last Modified 154364 seconds ago
or
>> Page Last Modified 59 hours ago

I hope you understood what I want to do...
Please help...:/

lorax

7:03 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If I understand you right, what you're asking for is how to format the date function to what you want. Go here [php.net].

Or are you asking for how to determine the length of time since the last update?

F8lsin

8:29 am on Apr 15, 2003 (gmt 0)

10+ Year Member



NO, I need something like, in the <snip>
there should be
>> Updated 16571 sec. ago.
or similarly...
could anyone help me?

[edited by: jatar_k at 2:44 pm (utc) on April 15, 2003]
[edit reason] no urls thanks [/edit]

mavherick

1:13 pm on Apr 15, 2003 (gmt 0)

10+ Year Member



Try this:

$last_modified = time() - filemtime("thepageyouwant.php");

print("Page Last Modified $last_modified seconds ago");

mavherick

F8lsin

3:43 pm on Apr 15, 2003 (gmt 0)

10+ Year Member



Ok thanx, what's that I want, but now, how to show that in minutes or hours?
like
265 minutes ago
or
49 hours ago
?
;)

mavherick

4:41 pm on Apr 15, 2003 (gmt 0)

10+ Year Member



Well how many seconds in a minute? divide result by 60!

hom many seconds in an hour? divide result by 3600!

mavherick