Linux for new users part 6 – time

Continuing my series for those new to running Moodle on a linux server and using a Terminal.

Open a terminal using Ctrl+Alt+T (or whatever method you prefer now). We will continue exploring the date command by looking at the time display options.

Try the following command options one by one:

%T
%R
%r
%X
  • %T prints the time as HH:MM:SS.
  • %R prints the hour and minutes as HH:MM with no seconds, using the 24-hour clock.
  • %r prints the time according to your locale, using the 12-hour clock and an AM or AM indicator.
  • %X prints the time according to your locale, using the 24-hour clock.

A little reminder there again too, the %R and %r do different things.

What about specific hours? Try these options:

%H
%I
  • %H prints the hour 00, 01, 02 … 23.
  • %I prints the hour using the 12-hour clock, 00, 01, 02 … 12, with a leading zero if required.

What about specific minutes? Try this:

%M
  • %M prints the minute, 01, 02, 03 … 59, with a leading zero if required.

We might as well finish off with seconds eh? Try these:

%s
%S
%n
  • %s prints the number of seconds since 1970-01-01 00:00:00, the start of the Unix Epoch.
  • %S prints the seconds, 01, 02, 03 … 59, with a leading zero if required.

A final reminder there that %s and %S are different.

Stuart Mealor

Managing Director at HRDNZ
Stuart is interested in all things e-learning, with specific interests in Moodle, e-learning strategy, and business development.His experience in education over 30 years, MBA in International Business, and knowledge of e-learning systems implementation, together with graphic design background, give him a unique skill set for e-learning projects.

Latest posts by Stuart Mealor (see all)

Stuart Mealor

Stuart is interested in all things e-learning, with specific interests in Moodle, e-learning strategy, and business development. His experience in education over 30 years, MBA in International Business, and knowledge of e-learning systems implementation, together with graphic design background, give him a unique skill set for e-learning projects.

Add a reply or comment...

%d bloggers like this: