Time Extensions

i am a beginner in YII framework, does anyone know how to install this extension?

http://www.yiiframework.com/extension/time/

how to install this extension is not explained in its documentation. i want to convert a timestamp to format "time ago" "1 hour ago" "2 hours ago".

i have extracted the extensions in extension folder,but i don’t know how to use it.

Given that it’s just a static helper class, I would put the PHP file straight into your components directory. It will automatically be imported by Yii.

Use it like so:




$timeStr = Time::timeAgoInWords($dateTime);



thanks, it works. I don’t know that static helper and extension is different.

It’s not technically different, but I don’t see any point in adding a directory in extensions for a very simple class. If you wished to do that, you would just need to add an additional import in your config file.