简体   繁体   中英

PHP/Kohana - Converting time to different format

In my kohana app, I need to convert the time retrieved from the database into a format like 45 seconds ago, 1 minute ago, etc. What is the best place to do it? Can I override any methods in the Model so that the method automatically converts the time into the desired format before returning into the controller?

The Date::span() and Date::fuzzy_span() methods do it.

Please do some research before asking questions. It took me 30 seconds to find them... Google "kohana date format", click the first link, and look through the methods.

他是整个date文档: [链接]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM