unix时间戳转换

Posted by 4Aiur on 05/14/2010 in SysAdmin |

unix时间戳转换, Convert unix timestamp

utime(){ date -d @$1; }
utime(){ date -d "1970-01-01 GMT $1 seconds"; }
utime(){ awk -v d=$1 'BEGIN{print strftime("%a %b %d %H:%M:%S %Y", d)}'; }
utime(){ perl -e "print localtime($1).\"\n\""; }
utime(){ python -c "import time; print(time.strftime('%a %b %d %H:%M:%S %Y', time.localtime($1)))"; }

[root@test test]# utime(){ date -d @$1; }
[root@test test]# utime 1273817956
Fri May 14 14:19:16 CST 2010

[root@test test]# utime 1273817956
Fri May 14 14:19:16 CST 2010

[root@test test]# utime(){ awk -v d=$1 'BEGIN{print strftime("%a %b %d %H:%M:%S %Y", d)}'; }
[root@test test]# utime 1273817956
Fri May 14 14:19:16 2010

[root@test test]# utime(){ perl -e "print localtime($1).\"\n\""; }
[root@test test]# utime 1273817956
Fri May 14 14:19:16 2010

[root@test test]# utime(){ python -c "import time; print(time.strftime('%a %b %d %H:%M:%S %Y', time.localtime($1)))"; }
[root@test test]# utime 1273817956
Fri May 14 14:19:16 2010
[root@test test]#

Tags:

Copyright © 2010-2019 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.