The date command in Linux to display the system date. But it is also possible to use it to change the date and time of the system.
1. Change the date and time of system
To do this, we must provide the information and setting the following syntax:
where MM is the month, DD the day, hh hour, mm minute, ss YY the year and second, all on two counts.
Here is an example of use, here we add ten minutes:
Tue Aug 30 14:40:12 CEST 2008
# date 0830145008.00
Tue Aug 30 14:50:00 CEST 2008
It is also possible to change only with time and date using the following syntax:
* Date-s HH: MM: SS: To change only the time
Date-s * MM / DD / YYYY: to change the date only
# date -s 12:10:00
Tue Aug 30 12:10:00 CEST 2008
# date -s 01/01/2000
Sat Jan 1 00:00:00 CET 2000
2. Change the date and time of BIOS
All these operations can certainly change the date and time of the system, but the problem is that the BIOS clock (electronic component located on the motherboard) is perhaps not necessarily synchronized with the latter. This can be annoying, especially since the Linux system is based on the BIOS at startup to configure all the time information.
The hwclock command, lets you know the date and time provided by this component:
Tue 30 Aug 2008 02:48:51 PM CEST -0.013269 seconds
It is of course possible to synchronize the BIOS with the date and time of the system via this command:
# hwclock –systohc