Home: Perl Programming Help: Intermediate:
Changing the system's time and date using Perl



alantyss
Deleted

Jul 27, 2000, 4:18 PM


Views: 1498
Changing the system's time and date using Perl

What I have done in my program so far is split a line in a log file that contains a lot of information where date and time are two pieces of the information. I have stored time into $time (where time is in the format 00.00 hours and minutes) I then stored the date into $date (where it is in the format dd/mm/yy). What I need to do now is add 15 minutes to the time and then change the system time and date using my new time and date variables. How do I do this??? If anyone can solve this for me then I will owe them big. I am not a great programmer in Perl. PLEASE HELP!!


randor
User

Jul 28, 2000, 9:16 AM


Views: 1498
Re: Changing the system's time and date using Perl

Im not posative on this one but you may want to try this:

$timechange = '15';
$datechange = '3';

$time = ($hr.$sec);
@time = split/\./, $time);
@time[2] = (@time[1] + $timechange);
$time = ($hr.@time[1]);

$date = ($dd/$mm/$yy);
@date = split/\//, $date);
@date[2] = (@date[2] + $datechange);
$date = ($dd/$mm/@date[2]);