A while ago, I was learning how to write a custom function in Google Docs Spreadsheet, even wrote a wiki page to note about input and output of custom function. I picked timeago function as an exercise.

I submitted the finished script to gallery, you could find it by searching “timeago”:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6wTrqWhBaQjyWKghX5jZrmT4RkSebcT6csCfgOhzRJiSDYcR-BrfzR6f8LQfSbtr5tRSzfdtPKGj4-PQGT6YE99zaCKLVnWd8U2rFeysFSLYs1hppHBPIggzygucE_ThDdA3LfJ2GirM/s1600/timeago+in+Google+Docs+Spreadsheet.png

Here is the test spreadsheet.

For the source code, I think you can view it in that test spreadsheet or after you install the script, not really sure. I lost my interest in writing custom function since I don’t need any for practical uses.