date cal 命令

date 可以用来显示或设定系统的日期与时间

DATE(1)                          User Commands                         DATE(1)

NAME

      date - print or set the system date and time (输出和设置系统的时间和日期)

SYNOPSIS (命令格式用法)

      date [OPTION]... [+FORMAT]  

      date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

DESCRIPTION

      Display the current time in the given FORMAT, or set the system date. (显示当前时间在给定的格式,或设置系统日期)

      -d, --date=STRING (显示字符串描述命令)

             display time described by STRING, not ‘now’

      -f, --file=DATEFILE (类似--date,从日期文件中按行读入时间描述)

             like --date once for each line of DATEFILE

      -r, --reference=FILE 显示文件指定文件的最后修改时间)

             display the last modification time of FILE

      -R, --rfc-2822 (以RFC 2822格式输出日期和时间)

             output date and time in RFC 2822 format.  Example: Mon, 07 Aug 2006 12:34:56 -0600 (以RFC-2822兼容日期格式显示时间)

      --rfc-3339=TIMESPEC (以RFC 3339 格式输出日期和时间)

             output date and time in RFC 3339 format.  TIMESPEC=‘date’, ‘seconds’, or ‘ns’ for date and time to the indicated precision.  Date and time components are separated by a single space: 2006-08-07 12:34:56-06:00

      -s, --set=STRING (设置时间为STRING)

           set time described by STRING

      -u, --utc, --universal  (显示或设定为Coordinated Universal Time时间格式)

           print or set Coordinated Universal Time

      --help display this help and exit (显示帮助)

      --version (大家都懂)

             output version information and exit

FORMAT controls the output.  Interpreted sequences are:

      %%     a literal %

      %a     locale’s abbreviated weekday name (e.g., Sun) (星期的缩写)

      %A     locale’s full weekday name (e.g., Sunday)(星期的完整名称)

      %b     locale’s abbreviated month name (e.g., Jan) (月份的缩写)

      %B     locale’s full month name (e.g., January) (月份的完整名称)

      %c     locale’s date and time (e.g., Thu Mar  3 23:05:25 2005) (日期时间)

      %C     century; like %Y, except omit last two digits (e.g., 20) (世纪年份除100后去整)

      %d     day of month (e.g, 01) (一个月的第几天)

      %D     date; same as %m/%d/%y  (日期mm/dd/yy)

      %e     day of month, space padded; same as %_d(一个月的第几天)

      %F     full date; same as %Y-%m-%d ( 日期,同%Y-%m-%d)

      %g     last two digits of year of ISO week number (see %G)    (年份yy)

      %G     year of ISO week number (see %V); normally useful only with %V (年份yyyy)

      %h     same as %b (同%b)

      %H     hour (00..23) (小时00..23)

      %I     hour (01..12)  (小时01..12)

      %j     day of year (001..366) (一年的第几天001..366)

      %k     hour ( 0..23) (小时0..23)

      %l     hour ( 1..12)  (小时1..12)

      %m     month (01..12)  (月份01..12)

      %M     minute (00..59)  ( 分钟00..59)

      %n     a newline   (换行)

      %N     nanoseconds (000000000..999999999) (纳秒000000000..999999999)

      %p     locale’s equivalent of either AM or PM; blank if not known  (AMorPM)

      %P     like %p, but lower case (am or pm)

      %r     locale’s 12-hour clock time (e.g., 11:11:04 PM)  (12小时制)

      %R     24-hour hour and minute; same as %H:%M (24小时制)

      %s     seconds since 1970-01-01 00:00:00 UTC (从00:00:00 1970-01-01 UTC开始的秒数)

      %S     second (00..60) (秒00..60)

      %t     a tab (制表符)

      %T     time; same as %H:%M:%S (24小时制时间hh:mm:ss)

      %u     day of week (1..7); 1 is Monday (一周的第几天1..7;  1 表示星期一)

      %U     week number of year, with Sunday as first day of week (00..53) (一年的第几周,周日为每周的第一天00..53)

      %V     ISO week number, with Monday as first day of week (01..53) (一年的第几周,周一为每周的第一天 01..53)

      %w     day of week (0..6); 0 is Sunday  (一周的第几天 0..6;  0 代表周日)

      %W     week number of year, with Monday as first day of week (00..53) (一年的第几周,周一为每周的第一天00..53)

      %x     locale’s date representation (e.g., 12/31/99)  (日期mm/dd/yy)

      %X     locale’s time representation (e.g., 23:13:48)(时间%H:%M:%S)

      %y     last two digits of year (00..99) (年份00..99)

      %Y     year (年份)

      %z     +hhmm numeric timezone (e.g., -0400) (RFC-2822 风格数字格式时区-0400)

      %:z    +hh:mm numeric timezone (e.g., -04:00)  

      %::z   +hh:mm:ss numeric time zone (e.g., -04:00:00)

一些例子 (显示格式)

111451778.png

修改日期

111552789.png


注:一般只有root 用户才能修改  普通用户只能查看   本人自己做过实验在root 下date -s 一个时间  重启后发现硬件时间也被做了修改 难道证明一般只有root才能做date -s 如果真是这样的话那么date -s 将会很危险


hwclock    -w 以系统时钟为准  将硬件时间改为系统时间   -s  以硬件时钟为准   将系统时间改为硬件时间


查询

明天是几号

111945932.png

明天的年月日

111811139.png




摘:

   UTC  协调世界时,又称世界统一时间,世界标准时间,国际协调时间,简称UTC。它从英文“Coordinated Universal Time”/法文“Temps Universel Cordonné”而来

   RFC  Request For Comments (RFC),是一系列以编号排定的文件。文件收集了有关因特网相关资讯,以及UNIX和因特网社群的软件文件。目前RFC文件是由Internet Society(ISOC)所赞助发行

CST  可以同时表示美国,澳大利亚,中国,古巴四个国家的标准时间


cal 命令

cal 显示简单的日历命令

CAL(1)                    BSD General Commands Manual                   CAL(1)

NAME

    cal - displays a calendar

SYNOPSIS

    cal [-smjy13] [[[day] month] year]

DESCRIPTION

    Cal displays a simple calendar.  If arguments are not specified, the current month is displayed.  The options are as follows:

    -1      Display single month output.  (This is the default.) 显示一个月的月历

    -3      Display prev/current/next month output.  显示系统前一个月,当前月,下一个月的月历

    -s      Display Sunday as the first day of the week. 显示星期天为一个星期的第一天

    -m      Display Monday as the first day of the week.显示星期一为一个星期的第一天

    -j      Display Julian dates (days one-based, numbered from January 1).显示儒略日

    -y      Display a calendar for the current year.显示当前年份的日历

    -V      Display version information and exit.  都懂



112554276.png


显示 2010 10 月 31日 是星期几


112716694.png


部分摘要内容来自互联网   本人是新手有如有错误望请大家指正