PDA

View Full Version : How to know the date odf a server in a perl script?


Rod
07-18-2001, 02:38 AM
I need to make a field in a form, for the date of the current day, atthe server time.

The form is in a perl script...and I need to make the date to be written into a txt file.

What is the "code" to write in the script so that it wil take server's date?

Thanks,
Steve

tuzz
07-18-2001, 08:42 AM
Hi Rod

You don't need a field in the form. The date can be written from the script.

my $date = localtime(time)

puts server time into the $date variable.

Then add the $date variable to the statement that writes the txt file, like this one.

open (NEW, ">$config{'qlog'}$form{'CATEGORY5'}/$time5.dat"));
print NEW "$form{'URL5'}\n$form{'NUM5'}\n$form{'NAME'}\n$date";
close NEW;

adds server time and date as the last line of the file.

hope this helps

Bob