search for: days_in_month

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

2007 Mar 21
1
bug and patch: strptime first-of-month error in (possibly unsupported use of) "%j" format (PR#9577)
...================= PATCH: --- R/src/main/datetime.c (revision 40860) +++ R/src/main/datetime.c (working copy) @@ -796,7 +796,7 @@ if(tm->tm_yday != NA_INTEGER) { /* since we have yday, let that take precedence over mon/mday */ int yday = tm->tm_yday, mon = 0; - while(yday > (tmp = days_in_month[mon] + + while(yday >= (tmp = days_in_month[mon] + ((mon==1 && isleap(1900+tm->tm_year))? 1 : 0))) { yday -= tmp; mon++;
2006 Feb 28
5
Getting number of days in a month
In PHP, there was an argument you could pass to the Date function to get the number of days in the current month: echo date("t"); // Outputs "28" for February I don''t see anything like this in Ruby/Rails. Right now, I''m using a very ugly line to pull the last day of the month: @number_of_days = (Date.strptime(Date.today.strftime("%Y-%m-01"))
2005 Sep 21
2
Date Validation: The February 31st Problem
Hi Railers, I''m wondering if anyone has found a nice solution to the problem of validating dates to prevent things like 29th February 2005, or 31st September and so on? I see it was discussed before... http://wrath.rubyonrails.org/pipermail/rails/2005-March/003804.html ...but with no particularly ideal solution... http://wrath.rubyonrails.org/pipermail/rails/2005-March/003815.html
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i have their d.o.b. stored as a date in my db. cheers -- Posted via http://www.ruby-forum.com/.