Today, yesterday, 2 days ago, 3 days ago, etc

Is their a method within rails that if you pass it a DateTime it
returns that amount of days that have passed since then in the today,
yesterday, 2 days ago, etc format. I could of sworn I say a method
that did that.

Thanks


John K.
[email protected]

http://www.kopanas.com

http://www.soen.info

John K. wrote:

Is their a method within rails that if you pass it a DateTime it
returns that amount of days that have passed since then in the today,
yesterday, 2 days ago, etc format. I could of sworn I say a method
that did that.

Thanks


John K.
[email protected]

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info

this? time_ago_in_words(from_time, include_seconds = false)

John K. wrote:

Is their a method within rails that if you pass it a DateTime it
returns that amount of days that have passed since then in the today,
yesterday, 2 days ago, etc format. I could of sworn I say a method
that did that.

There’s since, from_now, etc here:
http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Numeric/Time.html

or

Chronic does a good job: http://rubyforge.org/projects/chronic/
Would love if it could do business day translation :slight_smile:

Screencast: http://podcast.sdruby.com/podcasts/008_chronic.m4v

Perfect… thanks :slight_smile:

On 1/28/07, David C. [email protected] wrote:


John K.
[email protected]

http://www.kopanas.com

http://www.soen.info