在linux系统中date命令用来显示和设定时间,其命令格式为date [参数] [格式].
1. 显示当前时间
root@iZuf6ic9ggky8ivrx52hxvZ:~# date
Mon Dec 31 10:32:40 CST 2018
root@iZuf6ic9ggky8ivrx52hxvZ:~# date +'%c'
Mon 31 Dec 2018 10:33:04 AM CST
root@iZuf6ic9ggky8ivrx52hxvZ:~# date +'%D'
12/31/18
root@iZuf6ic9ggky8ivrx52hxvZ:~# date +'%x'
12/31/2018
root@iZuf6ic9ggky8ivrx52hxvZ:~# date +'%T'
10:34:38
root@iZuf6ic9ggky8ivrx52hxvZ:~# date +'%X'
10:34:58 AM
2. 显示月份和日期
root@iZuf6ic9ggky8ivrx52hxvZ:~# date '+%B %d'
December 31
参考:https://www.cnblogs.com/peida/archive/2012/12/13/2815687.html