To change the system date in Linux, you can use the date command with superuser privileges. Here’s how to do it:
Open the Terminal.
Use the
datecommand with the desired format. The general syntax is:sudo date MMDDhhmm[[CC]YY][.ss]MMis the month (01-12)DDis the day (01-31)hhis the hour (00-23)mmis the minute (00-59)CCis the first two digits of the year (optional)YYis the last two digits of the year (optional)ssis the seconds (optional)
Example: To set the date to August 2, 2024, at 10:30 AM, you would run:
sudo date 080210302024Verify the Change: After changing the date, you can verify it by running:
date
Note: Changing the system date may require administrative privileges, and it's important to ensure that the new date is correct to avoid issues with scheduled tasks and logging.
