使用 Perl 代码从机场代码查找时区
因为我现在正在努力阻止特定航班显示出发时间是否在预订时间的 3 小时内。因为,我需要获取出发机场的时区,将其转换为 GMT,从而获得预订时间和航班出发时间之间的正确差异。我搜索了许多 CPAN 模块来完成机场代码和时区之间的映射,但没有得到任何合适的解决方案。如果有人能帮助我找到一些好的解决方案,那就太好了。
As I am right now working on blocking the particular flight to display if the departing time is with in 3 hours of booking time. As, I need to get the timezone of the departing airport to convert it to GMT and thus get the proper difference between the time of booking and departing time of flight. I have searched for many CPAN modules to do the mapping between the airport code and the timezone but I didn't get any proper solution.It will be great if anybody will helpful to me in finding some good solution to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道您是否会找到 CPAN 模块,但也许您可以自己制作一个转换器 - 它应该足够简单,只需一个将机场代码映射到时区的小型数据库表。
我发现以下链接包含超过 5,000 个机场代码及其相对于 UTC 的时区的 CSV 文件。
http://openflights.org/data.html
您可以将该链接中的 CSV 导入到您自己的数据库中然后让您的代码在该表中的时区和机场附近工作。
I don't know if you will find a CPAN module, but perhaps you can make a converter yourself - it should be simple enough with a small database table mapping airport codes to timezones.
I found the following link containing a CSV file of over 5,000 airport codes and their timezone relative to UTC.
http://openflights.org/data.html
You can import the CSV from that link into your own database and then have your code work around the timezones and airports in that table.