The date command in BSD systems provides the following features:
It outputs the time in a specific format. The date command can display the current date and time in various formats, depending on the options and arguments given. For example, the command date +%Y-%m-%d will output the date in the format of year-month-day, such as 2023-04-30. The command date +%T will output the time in the format of hour:minute:second, such as 22:51:42. The command date +%A will output the full name of the weekday, such as Thursday. The date command supports many formatting characters that can be used to customize the output. For a full list of formatting characters, see the date(1) manual page1.
It sets the clock to a specific time. The date command can also be used to set the system date and time, if the user has the appropriate privileges. For example, the command date 0430225123 will set the date and time to April 30, 2023, 22:51:42. The command date -u 0430225123 will set the date and time to the same value, but in UTC (Coordinated Universal Time) instead of the local time zone. The command date -n will set the date and time to the current network time, using the ntpd(8) daemon1.
The date command does not provide the following features:
It does not display a calendar. The date command only displays the date and time, not a calendar. To display a calendar, the cal(1) or ncal(1) commands can be used instead. For example, the command cal 4 2023 will display the calendar for April 2023. The command ncal -w 2023 will display the calendar for the whole year 2023, with week numbers23.
It does not send NTP queries. The date command does not send any network requests or queries to NTP (Network Time Protocol) servers. To synchronize the system clock with NTP servers, the ntpd(8) daemon or the ntpdate(8) utility can be used instead. For example, the command ntpd -q will query one or more NTP servers and adjust the system clock accordingly. The command ntpdate pool.ntp.org will set the date and time to the value returned by the NTP server pool.ntp.org45.
It does not change the system’s timezone. The date command does not change the system’s timezone setting, only the date and time values. To change the system’s timezone, the tzsetup(8) utility or the ln(1) command can be used instead. For example, the command tzsetup will run an interactive program that allows the user to select a timezone from a list of regions and cities. Thecommand ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime will create a symbolic link from the file /etc/localtime to the file /usr/share/zoneinfo/Europe/Paris, which contains the timezone information for Paris, France . References:
date(1) - FreeBSD
cal(1) - FreeBSD
ncal(1) - FreeBSD
ntpd(8) - FreeBSD
ntpdate(8) - FreeBSD
[tzsetup(8) - FreeBSD]
[ln(1) - FreeBSD]