linux date时间戳互相转换

简介:
1.查看指定时间的时间戳

查看当前时间
#date +%s

查看指定时间
#date -d 2008-01-01 +%s  
 1199116800
#date -d 20080101 +%s
1199116800

2.将时间戳转换成date
#date -d '1970-01-01 UTC 1199116800 seconds'
2008年 01月 01日 星期二 00:00:00 CST

#export LANG=en
#date -d '19700101 UTC 1199116800 seconds'  

 Tue Jan  1 00:00:00 CST 2008 















本文转自leonardos51CTO博客,原文链接: http://blog.51cto.com/leomars/1891406,如需转载请自行联系原作者





相关文章
|
5月前
|
Linux Shell
10-8|linux date设置时间
10-8|linux date设置时间
|
7月前
|
Linux Shell
linux date格式化获取时间
linux date格式化获取时间
101 1
|
8月前
|
安全 Linux 测试技术
|
8月前
|
Linux
linux centos history 查看命令历史 显示时间戳
linux centos history 查看命令历史 显示时间戳
355 1
|
9月前
|
Linux
Linux:时间指令 - cal & date
Linux:时间指令 - cal & date
77 2
|
9月前
|
安全 Linux 开发工具
Linux中可引起文件时间戳改变的相关命令
【4月更文挑战第12天】Linux中可引起文件时间戳改变的相关命令
137 0
|
9月前
|
Linux
Linux常用指令-date,cal,histroy,find
Linux常用指令-date,cal,histroy,find
130 0
|
9月前
|
Linux
Linux 指令|date|cal|find|grep|热键
Linux 指令|date|cal|find|grep|热键
|
9月前
|
Linux
Linux系统之date命令的基本使用
Linux系统之date命令的基本使用
138 3
|
9月前
|
存储 安全 数据管理
Linux文件时间戳:解析时区与修改时间的相互作用
Linux文件时间戳:解析时区与修改时间的相互作用
177 2