The 1.hour.from_now gives UTC time and as I’m GMT +1, I get the same time as Time.now. Maybe an hint on this issue could help? I’m new to Ruby but not to programming so it didn’t puzzled me but as far as the command is concerned, I don’t personaly get the time “1 hour from now”!
This happens because from_now uses Time.current, which does not consider the time zone. Time.now, however, does respect the Time.zone setting. Since @time already is set using Time.now, you can change the code as shown below to correctly show the time one hour from now based on your time zone setting: <%= 1.hour.since(@time) %>
Can someone please explain 1.hour as well ? what does .hour do ?