Time question

E

Eva

SGVsbG8sCgpXaHkgVGltZS5ub3cgLSA4NjQwMCB3b3Jrcz8KCmJ1dCB3aGVuIEkgdHJpZWQgVGlt
ZS5ub3coLTg2NDAwKSBpdCB3b24ndCB3b3JrLgpJIHdhcyB0aGlua2luZyAtODY0MDAgaXMgYW4g
YXJndW1lbnQgZm9yIHRoZSBjbGFzcyBtZXRob2QgIm5vdyIuCgpUaGFua3MuCg==
 
D

Dan

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".

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top