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.
Ba79eb31ceaef95e9e52f5e5e4ec6d02?d=identicon&s=25 John Kopanas (Guest)
on 2007-01-28 23: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 Kopanas
john@kopanas.com

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info
4f384e9f3e8e625aae72b52658323d70?d=identicon&s=25 usser (Guest)
on 2007-01-29 00:05
John Kopanas 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 Kopanas
> john@kopanas.com
>
> 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...
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2007-01-29 00:08
John Kopanas 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
Ba79eb31ceaef95e9e52f5e5e4ec6d02?d=identicon&s=25 John Kopanas (Guest)
on 2007-01-29 15:40
(Received via mailing list)
Perfect... thanks :-)

On 1/28/07, David Coleman <rails-mailing-list@andreas-s.net> wrote:
>
>
> >
>


--
John Kopanas
john@kopanas.com

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info
This topic is locked and can not be replied to.