|
|
Re: Dates Don't Always Add Up
|
Posted: Oct 28, 2008 9:41 AM
|
|
> <p> > I don't even know what to say about this? Anyone know why > this happens? > </p> > <pre> > >> Date.today -1 > => Sat, 25 Oct 2008
Here you are calling Date.today with -1 as the first parameter. (Check the doc., it takes an optional parameter.) You could have equivalently written Date.today(-1). That parameter doesn't do anything relevant in this case (In fact, I'm not clear on its function.), so you get today's date.
> >> Date.today - 1 > => Fri, 24 Oct 2008
Here you are subtracting 1 from today, so you get yesterday.
> >> Date.today > => Sat, 25 Oct 2008
No surprise here.
> </pre>
|
|