Time question

Hello,

Why Time.now - 86400 works?

but when I tried Time.now(-86400) it won't work.
I was thinking -86400 is an argument for the class method "now".

Thanks.

Time.now.-(86400)

"- is the method here on the Time object that Time.now returns..."

···

--
Thanks & Regards,
Dhruva Sagar.

2010/11/18 Eva <eva54321@sina.com>

Hello,

Why Time.now - 86400 works?

but when I tried Time.now(-86400) it won't work.
I was thinking -86400 is an argument for the class method "now".

Thanks.

Time.now cannot take any arguments.
So Time.now(-86400) or Time.now -86400 fails.
But that's not how your first line is being interpretted. You're creating a new Time object (with zero arguments) and then subtracting 86400 seconds from it.

···

On Thu, 18 Nov 2010 02:25:53 -0500 Eva <eva54321@sina.com> wrote:

Why Time.now - 86400 works?

but when I tried Time.now(-86400) it won't work.
I was thinking -86400 is an argument for the class method "now".

--
Dan <orgdotuk@yahoo.co.uk>