Monday, January 21, 2013

Linux Server Time

Linux servers time may be not adjusted to the local time zone so it may make some problem if we use the time in any process in our project.
To know the current time of the server:

1- Login to ssh.
2- Type the date command: date
3- The result will be something like that: Mon Jan 21 04:24:53 EST 2013

All Times are saved in a folder in the system its path is: /usr/share/zoneinfo/

and the local time of the server in the file its path is: /etc/localtime

We can change it to the local time zone by one command:
cp /usr/share/zoneinfo/Egypt /etc/localtime

Now if we type date it will return the local time of Egypt...

Regards,

2 comments:

  1. you can also change the time of the machine instance that runs your java application, independent of the system time

    ReplyDelete
    Replies
    1. i think this is the general solution if you are the owner of the server

      Delete