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 local system time



Jul 27, 2000, 12:13 PM

Post #1 of 2 (1517 views)
Changing local system time Can't Post

I am working on a program in Perl where I need to take the time and date parameter found in a text file and then pass it onto a file called runpro.cmd that needs to be run under DOS this way I can change the time. Does anyone have any ideas as to how I can shell to dos within my Perl program so that I can change the system date and time and then return back to my perl script? Please help me I am lost. Thank you


Jul 27, 2000, 3:32 PM

Post #2 of 2 (1517 views)
Re: Changing local system time [In reply to] Can't Post

There is a way to change the time in perl without having to ever leave the script.

example, This converts pacific time to EST time. 3 hour difference

(@etime) = localtime(time() + 3 * 3600);

+ 3

add 3 hours to server time

* 3600

I don't know but you have to use it when converting time.

print "$etime[2]";

printed the current hour.

if you want to subtract time the do just that,

(@etime) = localtime(time() - 3 * 3600);

Hope this is what you needed. Smile



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

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