Files
My-Notes/笔记/Linux/基础指令/date.md
T
2026-07-01 22:02:35 +08:00

19 lines
438 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# date \[d] \[格式化字符串]
作用:按照给定的字符串显示日期,一般用于日期计算
参数:
- 格式化字符串:
- %Y年(1999,2026
- %y年份后两位数字(0099
- %M月份(0112
- %d日(0131
- %H小时(0023
- %M分钟(0059
- %S秒(0060
- %s自1970-01-01 00:00:00 UTC到现在的秒数
示例:
- date
- date +%Y-%m-%d
- date "+%Y-%m-%d %H:%M:%S"