created_at to utc
在 Ruby 中,可以使用
utccreated_at
created_at_utc = created_at.utc这个代码片段将
created_atcreated_at_utc
注意,转换为 UTC 时间的对象和本地时间对象的区别在于,UTC 对象的
zone"UTC"zonestrftime%Z"UTC"
created_at_utc.strftime("%Y-%m-%d %H:%M:%S %Z") # => "2021-10-01 12:34:56 UTC"这个代码片段将
created_at_utc"2021-10-01 12:34:56 UTC"