ruby - Date time parse or time class? -
this ruby
need understanding time.parse. want output "2011-01-02 11:00:00"
but getting "2011-01-02 11:00:00 -0800" following code. ideas?
require 'time' def measure time.parse("2011-1-2 11:00:00") end
it printing number of hours timezone off utc. can use time#strftime
extract fields interested in
def measure t = time.parse("2011-1-2 11:00:00") t.strftime "%y-%m-%d %h:%m:%s" end # irb(main):037:0> measure # => "2011-01-02 11:00:00"
Comments
Post a Comment