[thelist] Posted: [x] days ago - date last_modified?

Paul Bennett paul at clicksave.co.nz
Tue May 4 20:32:29 CDT 2004

rsusoeff wrote:

>I see some news items and blogs with posting dates in this format:
>Posted: [x] days ago
>I'm familiar with echoing date/time or date last_modified, but close review
>of date/time in the php manual and extensive Googling hasn't given me a clue
>as to how this is done. What's the answer?
<self-promoting bluster>Having worked a lot with time critical web 
applications </self-promoting bluster>, finding php's strtotime() 
function was a boon - basically it gives you a value in seconds from Jan 
1, 1970 (from memory) to the time you pass it (you can pass it a variety 
of date stamps). This gives you a benchmark to work from, as you can 
take the current timestamp by using strtotime ('now), or simply now() 
and then work out the difference in seconds between the post stamp and 
the current stamp.
Once you have the diff in seconds, translating to hours / days is academic.

>Thanks in advance, Rick.

More information about the thelist mailing list