0
我需要以毫秒爲單位的時間自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
任何最受歡迎的幫助