> ## Documentation Index
> Fetch the complete documentation index at: https://help.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Date and Time

> Configure timezone and time synchronization on your VPS

Correct date and time settings are important for logs, scheduled tasks, and applications.

<Info>
  **Prerequisites**

  * A VPS with OnetSolutions
  * SSH access to your server
</Info>

## Setting the Timezone

<Tabs>
  <Tab title="Interactive Method">
    Run the timezone configuration wizard:

    ```bash theme={null}
    sudo dpkg-reconfigure tzdata
    ```

    Follow the on-screen prompts to select your region and timezone.
  </Tab>

  <Tab title="Command Line Method">
    Set the timezone directly:

    ```bash theme={null}
    sudo timedatectl set-timezone Europe/Paris
    ```

    Replace `Europe/Paris` with your desired timezone.

    List all available timezones:

    ```bash theme={null}
    timedatectl list-timezones
    ```
  </Tab>
</Tabs>

<Note>
  Common timezone values: `Europe/Paris`, `Europe/London`, `America/New_York`, `Asia/Tokyo`, `UTC`
</Note>

## Time Synchronization (NTP)

<Tabs>
  <Tab title="Debian/Ubuntu">
    Install and configure NTP:

    ```bash theme={null}
    sudo apt update
    sudo apt install ntp ntpdate -y
    ```

    Sync time immediately:

    ```bash theme={null}
    sudo ntpdate pool.ntp.org
    ```
  </Tab>

  <Tab title="Using systemd-timesyncd">
    Enable time synchronization:

    ```bash theme={null}
    sudo timedatectl set-ntp true
    ```
  </Tab>
</Tabs>

## PHP Timezone Configuration

To set the timezone for PHP applications:

<Steps>
  <Step title="Find the PHP config file">
    ```bash theme={null}
    find /etc/ -name php.ini -type f
    ```
  </Step>

  <Step title="Edit the configuration">
    Open the php.ini file and add or modify:

    ```ini theme={null}
    date.timezone = "Europe/Paris"
    ```
  </Step>

  <Step title="Restart web server">
    ```bash theme={null}
    sudo systemctl restart apache2
    # or
    sudo systemctl restart php-fpm
    ```
  </Step>
</Steps>

## Verify Settings

Check current date, time, and timezone:

```bash theme={null}
timedatectl
```
