Chinaunix首页 | 论坛 | 博客
  • 博客访问: 425391
  • 博文数量: 126
  • 博客积分: 35
  • 博客等级: 民兵
  • 技术积分: 1262
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-19 16:39
文章分类

全部博文(126)

文章存档

2017年(2)

2016年(20)

2015年(64)

2014年(24)

2013年(16)

我的朋友

分类: Python/Ruby

2014-07-11 11:19:02



  1. date -d "@1234567890"

  2. date的用法
  3. NAME
  4.        date - print or set the system date and time
  5. SYNOPSIS
  6.        date [OPTION]... [+FORMAT]
  7.        date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
  8. DESCRIPTION
  9.        -d, --date=STRING
  10.               display time described by STRING, not ‘no
  11.        -r, --reference=FILE
  12.               display the last modification time of FILE

  13. [root@test1 scripts]# date
  14. 2011年 11月 23日 星期三 16:23:35 CST
  15. [root@test1 scripts]# date +"%Y-%m-%d %H:%M:%S"
  16. 2011-11-23 16:23:38
  17. [root@test1 scripts]# date --date="-24 hour" +"%Y-%m-%d %H:%M:%S"
  18. 2011-11-22 16:23:41
  19. [root@test1 scripts]# date --date="-20 hour" +"%Y-%m-%d %H:%M:%S"
  20. 2011-11-22 20:23:45
  21. [root@test1 scripts]# date -d "-24 hour" +"%Y-%m-%d %H:%M:%S"
  22. 2011-11-22 16:23:50
  23. [root@test1 scripts]# date -d "-1 week" +"%Y-%m-%d %H:%M:%S"
  24. 2011-11-16 16:23:53
  25. [root@test1 scripts]# date -d "-60 minute" +"%Y-%m-%d %H:%M:%S"
  26. 2011-11-23 15:24:36
  27. [root@test1 scripts]# date -d "-1 month" +"%Y-%m-%d %H:%M:%S"
  28. 2011-10-23 16:25:00

  29. expr $(expr `date -d"20150214" +%s` - `date +%s`) / 86400



阅读(694) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~