From: enspired Date: 2005-10-30T13:07:07+09:00 Subject: easiest way to set future date I need to calculate an end date based on a start date (Date.today + # of trial days). Basically, the app allows different services to be purchased for different durations. So one service might be a year while another might be 6 months. What's the best way to accomplish this, keeping in mind that service durations could be configured in days, months or years (although I could just make it months if adhering to YAGNI)? def before_create # set service_start_date/service_end_date based on service_level trial_days = self.service_level.trial_days || 0 start_date = Date.today + (trial_days * (24 * 60 * 60)) duration = self.service_level.duration # number of units * frequency frequency = self.service_level.frequency # can be 'D', 'M', 'Y' # determine end_date #end_date = start_date (???) self.service_start_date = start_date self.service_end_date = end_date end