Afficher un message
Vieux 23/02/2008, 20h48   #6
Wes Gamble
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: DateTime.new vs. DateTime.now

My findings are in agreement with yours.

If I call puts or strftime on DateTime.now, I will get local time.
If I call time component methods (hour, min, sec, etc.), I will get
local time.

But if I just take a DateTime.now and do math with it, it is in GMT.

I would assert that the strftime, puts, and all of the time component
methods do an implicit GMT-to-local time conversion as part of their
processing. That is the only thing that would explain the behavior that
I am seeing.

Thanks,
Wes

--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
 
Page generated in 0,04284 seconds with 9 queries