Chinaunix
标题:
如何在shell中将unix时间戳转换为系统时间
[打印本页]
作者:
love100
时间:
2005-11-29 17:59
标题:
如何在shell中将unix时间戳转换为系统时间
如何在shell中将unix时间戳转换为系统时间?
如:UNIX时间1133255350
作者:
寂寞烈火
时间:
2005-11-29 18:06
/home/lee#perl -e 'print scalar localtime(1133255350),"\n"'
Tue Nov 29 17:09:10 2005
作者:
love100
时间:
2005-11-29 18:36
晕,原来date -r 1133255350就可以呀。
作者:
寂寞烈火
时间:
2005-11-29 18:54
原帖由
love100
于 2005-11-29 18:36 发表
晕,原来date -r 1133255350就可以呀。
你的OS真nb,我的执行不了 :em11:
作者:
love100
时间:
2005-11-29 19:34
localhost[/home/test] -root-#date -r 1133255350
Tue Nov 29 17:09:10 CST 2005
localhost[/home/test] -root-#
作者:
dingyi129
时间:
2005-11-29 23:18
$ uname
FreeBSD
$ date -r 1133255350
Tue Nov 29 17:09:10 CST 2005
-r seconds
Print the date and time represented by seconds, where seconds is
the number of seconds since the Epoch (00:00:00 UTC, January 1,
1970; see time(3)), and can be specified in decimal, octal, or
hex.
复制代码
dingyi@backup:~/manpage$ uname
Linux
dingyi@backup:~/manpage$ date -r 1133255350
date: 1133255350: No such file or directory
#uname
AIX
#date -r 1133255350
date: Not a recognized flag: r
Usage: date [-u] [+"Field Descriptors"]
[
本帖最后由 dingyi129 于 2005-11-29 23:21 编辑
]
作者:
寂寞烈火
时间:
2005-11-30 02:30
GNU/Linux :
date "+%a %F %T" -d"1970-01-01 UTC 1133255350 sec"
复制代码
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2