DateTime now

When using DateTime.now, does the “now” method return the time based on
the
remote OS system time or the local time where the user actually invoked
the
“now” method, if they are using ssh and running the commands in a rails
console, for example?

On 15 September 2013 15:51, John M. [email protected] wrote:

When using DateTime.now, does the “now” method return the time based on the
remote OS system time or the local time where the user actually invoked the
“now” method, if they are using ssh and running the commands in a rails
console, for example?

It returns the time on the machine that is running the code, so if
they ssh into a machine to run it then it is the time on the machine
ssh’ed into. How could it be otherwise? The machine ssh’ed into does
not know anything about the client machine’s time settings.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs