Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time and Date 1

Status
Not open for further replies.

lamchop

IS-IT--Management
Nov 4, 2002
6
CA
I am doing a web page that contains a hyperlink that is time sensitive. During the "on" hours, I'd like the link to go to Page1.html but during the "off" hours, I want it to go to Page2.html.

Off hours are as follows:
Mon-Fri: 12:00am - 1:30am
Sat 6pm - Sun 12pm

I have everything all set up but I need a quick and easy way to get the time and date from the server. I don't know anything about PERL so I'm desperately in need of some help. Thanks in advance!
 
($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST)=LOCALtime(time);

#except all should be lowercase
 
So what date and time format does this produce? I'm not at all familiar with PERL. Do I dump this code in a .pl file? That's it? How do I call up this data?
 
($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST)=LOCALtime(time);

insert this code into a perl script and print the output.

print LOCALtime(time);

Then you will be able to see what the output is. Then try printing the following.

print "$SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST";

That will show you what each of the variable will output. Then just compare that number with > < or == to determine what page you want it to goto. If you have any more questions let me know.

Shelby
perl@smwebdesigns.com
 
What is the minimum amount of code I need to set up a perl script? (Similar to how you need at least the <html>, <head> and <body> tags for HTML.)
 
#!D:\win32app\Perl\bin\perl.exe
print &quot;Content-type: text/html\n\n&quot;;
($SEC,$MIN,$HOUR,$MDAY,$MON,$YEAR,$WDAY,$YDAY,$ISDST)=LOCALtime(time);
print &quot;seconds = $SEC<p>\n\n&quot;
print &quot;minutes = $MIN<p>\n\n&quot;
# use the above command for each of the outputs

You don't actually have to have a minimum amount of data as long as you send the content-type stuff.
 
So...
1. If I just wanted two separate variables, one for the Day of the week (Mon, Tue, Wed, etc) and another for the hour of the day (in AM/PM or the 24h clock), how would I isolate that into the format I want?

2. From my .html page, how do I retrieve the value stored in the variable passed from the perl script? I'm not sure how to hook it all together.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top