How to convert between local time and UNIX timestamp in Perl

Question: I need to convert readable date and time to a corresponding UNIX timestamp (i.e., Epoch time), or vice versa in a Perl program. Can you show me Perl code examples of converting date/time to UNIX timestamp, or conversely, converting UNIX timestamp to human-readable date and time? When your Perl script needs to deal with […]
Continue reading…

 

How to change date and time from the command line on Linux

Question: In Linux, how can I change date and time from the command line? Keeping the date and time up-to-date in a Linux system is an important responsibility of every Linux user and system administrator. Many applications rely on accurate timing information to operate properly. Besides, inaccurate date and time render timestamp information in log […]
Continue reading…

 

How to change timezone on Linux

Question: The current timezone of my Linux box is inaccurate, and I want to change the timezone of the system. How can I change time zone on Linux? If the default timezone of your Linux system is not correct, you need to correct it to get accurate local time. Note that configuring NTP is not […]
Continue reading…

 

How to set the default timezone in PHP

Question: How can I set the default timezone used by all date/time related PHP functions? The default timezone for PHP is defined in php.ini configuration file. So you will need to edit the file by hand. First, find the location of php.ini on your system as follows. In this example, it is found at /etc/php5/cli/php.ini. […]
Continue reading…