Finding System Date and Time

This lesson will guide you through getting system date and time in your desired format.

date

Definition:

The date command is used to print out or change system time and date.

Syntax:

date [+FORMAT]

Format:

Format Sequence Description
%a The abbreviated weekday name (e.g., Mon).
%A The full weekday name (e.g., Monday).
%b The abbreviated month name (e.g., Feb).
%B The full month name (e.g., February).
%c The date and time (e.g., Fri Feb 6 21:45:39 2018).
%d Day of month (e.g., 04).
%D Date; same as %m/%d/%y.
%F Full date; same as %Y-%m-%d.

Example:

  • To get system time and date:
date

Get hands-on with 1200+ tech skills courses.