【发布时间】:2018-03-11 13:42:04
【问题描述】:
我需要获取自 1970 年以来的今天以毫秒为单位的时间,其中 BST(英国夏令时)偏移
a = DateTime.now
=> Fri, 29 Sep 2017 16:30:29 +0100
b = DateTime.new(a.year, a.month, a.day, 0, 0, 0, 0)
=> Fri, 29 Sep 2017 00:00:00 +0000 # this is an hour out
b.strftime('%Q').to_i
1506643200000 # therefore this is an hour out
我该如何纠正这个问题?
b = b.in_time_zone
=> Fri, 29 Sep 2017 01:00:00 BST +01:00 # looks promising but...
b.strftime('%Q').to_i
=> 0 # grrr
欢迎任何帮助
【问题讨论】: