To quote an example from the Superuser forum:
It’s 6pm in Taipei, what time is it here?
date --date='TZ="Asia/Taipei" 18:00'
Fri Jul 16 11:00:00 BST 2010
At 11am here in London, what time is it in Taipei?
TZ=Asia/Taipei date -d "11:00 BST"
Fri Jul 16 18:00:00 CST 2010
To make a Perl script portable is to avoid using system commands as much as possible. To deal with date formats actions, you’d better use DateTime or Date::Calc modules.
For a simple formatting of the current date using localtime() Perl function :
use POSIX qw(strftime);
my $date = strftime “%d-%m-%y”, localtime;
Instead of :
my $date = qx(date +%d-%m-%y);
Both work. The first one is more Perlish 😉
More info :
POSIX Function strftime() in Perl
DateTime Perl module
Date::Calc Perl module
To change the time and the date, make sure you have root privileges :
To modify the time :
#date -s HH:MM:SS
To modify the date :
#date -s MM/DD/YYYY
If you want to know your BIOS time and date :
To synchronize BIOS date and time with your system’s date and time :