[root@365linux ~]# date
2010年 08月 10日 星期二 03:39:21 CST
[root@365linux ~]# date +%s
1281382775
[root@365linux ~]# date -d "2010-07-20 10:25:30" +%s
1279592730
3、將時間戳轉換爲標準時間格式
[root@365linux ~]# date -d "@1279592730"
2010年 07月 20日 星期二 10:25:30 CST
[root@365linux ~]# date -d "1970-01-01 utc 1279592730 seconds"
2010年 07月 20日 星期二 10:25:30 CST
[root@365linux ~]# date -d "1970-01-01 14781 days" "+%Y/%m/%d %H:%M:%S"
2010/06/21 00:00:00
[root@localhost tmp]# date -d "@1279592730"
Tue Jul 20 10:25:30 CST 2010
[root@localhost tmp]# date -d "@1279592730" +"%Y%m%d %H:%M:%S"
20100720 10:25:30
[root@localhost tmp]# date -d "@1279592730" +"%F %H:%M:%S"
2010-07-20 10:25:30
[root@localhost tmp]# date -d "1970-01-01 utc 1279592730 seconds"
Tue Jul 20 10:25:30 CST 2010
[root@localhost tmp]# date -d "1970-01-01 utc 1279592730 seconds" +"%F %H:%M:%S"
2010-07-20 10:25:30
[root@365linux ~]# echo "1279592730" |awk '{print strftime ("%F %T",$0)}'
2010-07-20 10:25:30
[root@365linux ~]# perl -e 'print localtime(1279592730)."\n";'
Tue Jul 20 10:25:30 2010
[root@365linux ~]# vim /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=true
ARC=false
[root@365linux ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
轉http://hi.baidu.com/taolizao/blog/item/2d6f9a1ba50ef3eae0fe0ba9.html