Linux or FreeBSD command to display system time and date

‮/:sptth‬/www.lautturi.com
Linux or FreeBSD command to display system time and date

To display the system time and date on a Linux or FreeBSD system, you can use the date command. For example:

date

This will display the current date and time in the following format:

Sat Dec 18 21:25:32 EST 2022

To display the time and date in a different format, you can use the -d option and specify a format string. For example:

date -d "2022-12-18 21:25:32" +"%Y-%m-%d %H:%M:%S"

This will display the date and time in the following format:

2022-12-18 21:25:32

You can use different format specifiers to display the time and date in a variety of formats. For example, to display the date in the format "Year Month Day", you can use the following command:

date +"%Y %B %d"

This will display the date in the following format:

2022 December 18

For more information on the format specifiers that you can use with the date command, you can refer to the command's man page or online documentation.

Created Time:2017-10-30 10:17:41  Author:lautturi