I’d like to have a count down to a certain date, but display it in
words, such as “123 days away” or something. I’m aware of the function
“distance_of_time_in_words_to_now()”, which will display “about 6 hours”
or “12 days” or something like that, but how can I get it to reverse?
Pass it a date for future reference, then it will error or be negative,
right?
I’d like to have a count down to a certain date, but display it in
words, such as “123 days away” or something. I’m aware of the function
“distance_of_time_in_words_to_now()”, which will display “about 6 hours”
or “12 days” or something like that, but how can I get it to reverse?
Pass it a date for future reference, then it will error or be negative,
right?
I’d like to have a count down to a certain date, but display it in
words, such as “123 days away” or something. I’m aware of the function
“distance_of_time_in_words_to_now()”, which will display “about 6 hours”
or “12 days” or something like that, but how can I get it to reverse?
Pass it a date for future reference, then it will error or be negative,
right?
Thanks, but won’t that always display ‘123 days’ (which was probably
just to show how it works)? How can I pass a date format for about a
year ahead of time?
Essentially:
@time_to_event = distance_of_time_in_words(Time.now, ‘Sat May 12
05:00:00 Easter Standard Time 2006’) @time_to_event #=> ‘365 days’
Then tomorrow, when you visit the site, it will say “364 days” then “363
days” etc…
I think I just need the format - can I pass the MySQL datetime format?