Saturday, July 29, 2006

Calculating time difference

Here is a Ruby on Rails function I wrote that returns time difference in minutes. It can be easily modified to return time difference in seconds, hours etc.


def time_diff_in_minutes (time)
diff_seconds = (Time.now - time).round
diff_minutes = diff_seconds / 60
return diff_minutes
end

1 Comments:

At 4:11 PM, Blogger Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

 

Post a Comment

<< Home

eXTReMe Tracker