如何将日期时间(在特定时区)转换为纪元秒
我在特定时区有一个日期时间对象,即“亚洲/东京”。
我使用 $dt = DateTime->now(time_zone => 'Asia/Tokyo'); 获取此日期时间;
其输出格式为 YYYY-MM-DD'P'HH:mm:ss
(P
是分隔符)
请帮助 perl 脚本将其转换为日期时间到纪元秒。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,如果使用
now
,无论指定哪个时区,都会得到相同的结果,并且与时间
。这些都指的是同一时间(现在):
这些指的是不同的时间:
Of course, you will get the same result no matter which time zone you specify if you use
now
, and it's going to be the same as the output oftime
.These all refer to the same time (now):
These refer to different times: