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
Linux命令(104)之date
Linux命令(104)之date
33 1
|
7月前
45Linux - 系统管理(显示或设置时间:date)
45Linux - 系统管理(显示或设置时间:date)
27 0
|
7月前
|
Linux
如何使用 Linux `date` 命令来指定时区?
如何使用 Linux `date` 命令来指定时区?
334 0
|
1月前
|
Linux
Linux系统之date命令的基本使用
Linux系统之date命令的基本使用
33 3
|
2天前
|
Linux
Linux:时间指令 - cal & date
Linux:时间指令 - cal & date
9 2
|
23天前
|
安全 Linux 开发工具
Linux中可引起文件时间戳改变的相关命令
【4月更文挑战第12天】Linux中可引起文件时间戳改变的相关命令
28 0
|
25天前
|
Linux
Linux常用指令-date,cal,histroy,find
Linux常用指令-date,cal,histroy,find
34 0
|
29天前
|
Linux
Linux 指令|date|cal|find|grep|热键
Linux 指令|date|cal|find|grep|热键
|
2月前
|
算法 Unix Shell
【Shell 命令集合 系统管理 】Linux 显示或设置系统时间和日期 date命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示或设置系统时间和日期 date命令 使用指南
40 0
|
2月前
|
Shell Linux C语言
【Shell 命令集合 文件管理】Linux 创建一个空的文件或者更新文件的访问和修改时间戳 touch命令使用指南
【Shell 命令集合 文件管理】Linux 创建一个空的文件或者更新文件的访问和修改时间戳 touch命令使用指南
45 0