MySQL, Oracle, Linux, 软件架构及大数据技术知识分享平台

网站首页 > linux / 正文

linux通过date命令获取昨天、明天、上月、下月、上年和下年

2024-11-26 15:28 huorong linux 4 ℃ 0 评论

获取昨天

date -d 'yesterday' # 或 date -d 'last day'

获取明天

date -d 'tomorrow' # 或 date -d 'next day'

获取上个月

date -d 'last month'

获取下个月

date -d 'next month'

获取上一年

date -d ’last year'

获取下一年

date -d 'next year' 此外你可以获取多天前,多天后,多个月前,多个月后,多年前或多年后

三年前

date -d '3 year ago'

五年后

date -d '-5 year ago'

两天后

date -d '-2 day ago'

一个月前

date -d '1 month ago'

Tags:linux获取系统时间

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言