CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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



Jul 27, 2000, 4:18 PM

Post #1 of 2 (1507 views)
Changing the system's time and date using Perl Can't Post

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!!


Jul 28, 2000, 9:16 AM

Post #2 of 2 (1507 views)
Re: Changing the system's time and date using Perl [In reply to] Can't Post

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]);


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives