在 Perl 中将 Unix 时间戳转换为可读日期 [英] Convert Unix timestamp to a readable date in Perl

查看:76
本文介绍了在 Perl 中将 Unix 时间戳转换为可读日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些 Unix 时间戳(例如,1357810480,所以它们主要是过去的).如何使用 Perl 将它们转换为可读的日期格式?

I have some Unix timestamps (for example, 1357810480, so they're mainly in the past). How can I transform them into a readable date-format using Perl?

推荐答案

您可以使用 本地时间.

You can use localtime for that.

my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($unix_timestamp);

这篇关于在 Perl 中将 Unix 时间戳转换为可读日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆