The date and time inside OpenVZ containers is virtualized, therefore cannot be changed directly from within the containers.
The date and time synchronization should be done from the host node (the physical server which hosts the VEs). Once the date and time on the host node are set, the changes will be reflected inside all the VEs.
The date and time on the host node can be synchronized with a Network Time Protocol (NTP) service by performing these steps:
1. Install the NTP package
In CentOS/RHEL, run:
```
yum install ntp
```
In Debian/Ubuntu, run:
```
apt-get install ntp
```
1. Start the NTP service
In CentOS/RHEL:
```
service ntpd start
```
In Debian/Ubuntu:
```
/etc/init.d/ntp start
```
1. Set the service to start at boot
In CentOS/RHEL:
```
chkconfig ntpd on
```
In Debian/Ubuntu:
```
update-rc.d ntp defaults
```
1. Check the status of the synchronization
```
ntpq -p
```
1. If you wish to manually force a synchronization, run the below command:
```
ntpd -gq
```
Remember, the date and time changes will only take effect inside the VEs once they have been configured on the host node. No additional steps are required inside the VEs.