Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
#wday and #cwday same thing?
Daniel Waite
4/22/2008 6:42:00 PM
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?
--
Posted via
http://www.ruby-...
.
1 Answer
Daniel Waite
4/22/2008 7:08:00 PM
0
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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
#wday and #cwday same thing?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password