From: Daniel Waite Date: 2008-04-23T04:08:06+09:00 Subject: Re: #wday and #cwday same thing? Daniel Waite wrote: > The documentation for #wday says that the start-of-week is Sunday. > #cwday says the start-of-week is Monday. > > However, in IRB, both methods return the same value. Today is Tuesday > for me, and they're both returning 2. I'm not sure if it's considering > Sunday or Monday as its start, because I dunno if it returns 0 for > start-of-week or 1. The doc makes it sound like it would start at 0, but > that's not something I want to gamble with. > > Anyone know what's going on? Ah, I see. Start-of-week for #wday is 0, and #cwday is 1. So they will _appear_ to be in sync until you reach each method's end-of-week, in which #wday end its run at 6, starting over again at 0. #cwday on the other hand, ends at 7 and begins its run at 1. Yay. -- Posted via http://www.ruby-forum.com/.