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


#1

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.
removed_email_address@domain.invalid

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


#2

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.
removed_email_address@domain.invalid

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

this? time_ago_in_words(from_time, include_seconds = false)
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M000572


#3

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


#4

Perfect… thanks :slight_smile:

On 1/28/07, David C. removed_email_address@domain.invalid wrote:


John K.
removed_email_address@domain.invalid

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