0
>> Time.now.strftime("%Z")
=> "CST"
>> DateTime.now.strftime("%Z")
=> "+08:00"
>> DateTime.new(2017, 2, 1, 17, 30, 0, "PST").strftime("%Z")
=> "-08:00"
所以我想打印出时区名称,所以我达到了strftime
。但是,如果我给它一个DateTime,它的行为就会有所不同。为什么会这样?这是否意味着我不能使用DateTime.new来初始化特定时区的任意时间?strftime%Z在时间和日期时间上的行为不同