Computer Science Fundamentals Operating Systems Subjective
Mar 12, 2013

How do you display current date & time in UNIX system?

Detailed Explanation

Date command displays the current data and time. A super user can set the date and time.
Syntax--
     date [options] [+format]
Common Options
     -u            Universal Time (or Greenwich Mean Time)
     +format    specify     the output format
     %a            weekday, Sun to Sat
     %h            month abbreviation, Jan to Dec
     %j            day of year, 001 to 366
     %n            <new-line>
     %t            <TAB>
     %y            last 2 digits of year, 00 to 99
     %D            MM/DD/YY date
     %H            hour, 00 to 23
     %M            minute, 00 to 59
     %S            second, 00 to 59
     %T            HH:MM:SS time


Ex--
     date
     Mon Jun 10 09:01:05 EDT 1996
     date -u
     Mon Jun 10 13:01:33 GMT 1996
     date +%a%t%D
     Mon 06/10/96
     date '+%y:%j'
     96:162

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback