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.
- H5P periodic table – 8th September 2023
- Moodle 4.0 – 15th May 2022
- Moodle 4.0 other highlights – 14th May 2022