Evolution Suggestion : Age
Reported by mfryde | March 27th, 2009 @ 10:27 AM
How can we easily calculate the age from a birthdate.
I was thinking of :
def compute_age_birthdate
dateCurrent = Time.now.strftime("%m-%d")
yearCurrent = Time.now.strftime("%Y")
parse_date birthDate, :pattern => "yyyy", :into => "birth_year"
parse_date birthDate, :pattern => "MM-dd", :into => "birth_date"
age = yearCurrent - "birth_year"
compute_age = """ birth_date > dateCurrent ? age : age - 1 """
eval_expression compute_age, :into => "age"
end
is there a better way ? it also raise the question : Howto simply create calculated Fields? here we have age - 1 for example. bu i will also have a need like ROUND(totalPlayTime / 1000, 1 )
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป