我在两台机器上运行 Rails,但从to_time
方法中得到不同的结果。我只检查了系统时区和Time.zone
配置,我错过了什么吗?谢谢
服务器 1
user@Server1:/var/www/app$ date
Wed Oct 23 23:56:35 MDT 2013
user@Server1:/var/www/app$ cat /etc/timezone
America/Denver
user@Server1:/var/www/app$ bundle exec rails c production
irb(main):011:0> Time.zone
=> (GMT+00:00) UTC
irb(main):012:0> Date.parse("10/24/2013").to_time
=> 2013-10-24 00:00:00 +0000
服务器 2
user@Server2:/var/www/app$ date
Thu Oct 24 00:03:28 MDT 2013
user@Server2:/var/www/app$ cat /etc/timezone
America/Denver
user@Server2:/var/www/app$ bundle exec rails c production
irb(main):002:0> Time.zone
=> (GMT+00:00) UTC
irb(main):003:0> Date.parse("10/24/2013").to_time
=> 2013-10-24 00:00:00 -0600