search for: years_ago

Displaying 4 results from an estimated 4 matches for "years_ago".

2006 Apr 20
4
Small Date Formatting Question regarding datetime_select()
Is there a way to make datetime_select() dropdowns work on a 12hr clock? I need to make a input field that works exactly like the reminders datetime selecton dropdowns in Backpack to populate a datetime field in my DB. i.e in the format: month, day, year ? hour (1-12) minute am/pm. Should I change my database to have a separate column for date and one for time and use date_select()? Can
2008 Nov 21
5
Getting the number of years between two dates
Hey, I need to get the number of years (as a number) between two dates. Here is what I have as a helper. # Returns the number of years between now and the specified date. def years_ago(date) dateDifference = DateTime.now - date results =Date.day_fraction_to_time(dateDifference) return results[0] / 24 / 365; end I''m sure there is a better way to do this. What is it? Thanks, Jim --~--~---------~--~----~------------~-------~--~----~ You received this messag...
2006 Apr 23
5
Controllers in folders and helper scope in Rails >1.0
Hi, Here''s my problem. I tried to google it, read the release-docs and haven''t found anything similar. My application uses folders to store controllers, as described in the Rails book. I need to have same-named controllers for admin and for users, so it looks like this: /app/controllers/admin/project_controller.rb /app/controllers/admin/...
2006 Oct 22
12
How to subtract months from time?
Hi there, Im reading a date out of a database and I need to subtract exactly 1 month from that date? It needs to be bullet proof so that if the date says 31 and the previous month only has 28 days it wont just subtract 1 from the month and make an illegal date. Thanks Petr -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this