Forum: Ruby on Rails today, yesterday, 2 days ago, 3 days ago, etc

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John K. (Guest)
on 2007-01-29 00:39
(Received via mailing list)
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
usser (Guest)
on 2007-01-29 01:05
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/Help...
Dave C. (Guest)
on 2007-01-29 01:08
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/C...

or

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

Screencast: http://podcast.sdruby.com/podcasts/008_chronic.m4v
John K. (Guest)
on 2007-01-29 16:40
(Received via mailing list)
Perfect... thanks :-)

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
This topic is locked and can not be replied to.