In Linux, there are codes that allow you to display that date and time in any format you like. These codes can be used at the command line or in the digital clock settings of your particular Linux distro or desktop environment.

Command Line

At the command line, the date command can be used to display date and time information. The simplest way to use this command is simply to open a terminal and type:

date

The date command may be followed by parameters to change the date and time format. Always place a plus sign before the parameter and a full colon or slash between parameters. For example:

date +%A
date +%d/%m/%Y
date +%H:%M:%S

%A: Display the full name of the day of the week
%a: Display the abbreviated name of the day of the week
%B: Display the full name of the month
%b: Display the abbreviated name of the month
%C: Display the abbreviated year
%c: Display the abbreviated day, date, and month, and full year and time
%D: Display the full date in numeric format
%d: Display only the date
%e: Display the abbreviated date, single numeral preceded with a space
%F: Display the full date in numeric format, year first
%H: Display the hour only
%I: Display the abbreviated hour
%j: Display the day of the year (1 – 365)
%k: Display the abbreviated hour, single numeral preceded with a space
%l: Display the abbreviated hour, single numeral preceded with a space, 12 hour
%M: Display the minute, numerical format
%m: Display the month, numerical format
%N: Display nanoseconds
%n: Display a new line
%P: Display AM or PM, lowercase
%p: Display AM or PM, uppercase
%r: Display time in 12 hour format
%R: Display time in 24 hour format
%S: Display seconds
%s: Display seconds since 01/01/1970 00:00:00
%T: Display time in %H:%M:%S format
%t: Display tab
%U: Display week of year, numerical format
%V: Display number of day of the week, with Monday as 01
%W: Display number of the day of the week, with Monday as 00
%w: Display number of the day of the week, with Sunday as 0
%X: Display time, HH:MM:SS format
%x: Display date, MM/DD/YYYY format
%Y: Display year
%y: Display last two digits of year
%Z: Display time zone, alphabetical
%z: Display time zone, numerical (-0600)
%:z: Display time zone, numerical (-06:00)
%::z: Display time zone, numerical (-06:00:00)

Digital Clock Settings

Most Linux distros have a digital clock which allows you to change the settings using these codes. Usually, simple codes alone will achieve the right results. There is no need to type date, or any preliminary symbols.

Digital Clock_371
Digital clock settings, LXDE desktop

For example to show the time in 12 hour format, type:

%r

To show the time in 24 hour format, type:

%R

To show the full day and time, type:

%A %x

To show the day, month, date, year, and time in 12 hour format, type:

%A %m %d %Y %r

You can experiment with different day, date and time settings to get the effect you want .

Additional Reading

Configure XScreenSaver to Display the Day, Date, and Time
How to Edit the Time and Date of Digital Photos in Linux

 

 

 

Leave a comment