Creating a Dynamic Date Filed

S

Sue Roussie

Hi,

This newbie needs some help. I have a drop down box that needs to
display 7 days worth of dates.

Example: Today is the 13th. The drop down box would display the dates
of: July 20, July 21, July 22, etc. The kicker also is that I need to
exclude Sundays.

Can this be done? And if so, how would I do it. My form is using a
simple cgi script to e-mail the results to a person.

Thanks,
Sue
 
J

Jeff Thies

Sue said:
Hi,

This newbie needs some help. I have a drop down box that needs to
display 7 days worth of dates.

Example: Today is the 13th. The drop down box would display the dates
of: July 20, July 21, July 22, etc. The kicker also is that I need to
exclude Sundays.

Can this be done? And if so, how would I do it.

This is not an html question, but this is an alt group so:

The local time function will give you this:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime();

if($wday eq '0'){
print 'It\'s sunday';
}

The problem you will have is accounting for the different lengths of
months and accounting for leap year because your days will span months.

If you know some perl you can build this out of the "everything and the
kitchen sink" of perl modules:

<URL: http://www.cise.ufl.edu/~sbeck/DateManip.html >

That will even tell you if it is a holiday. There is a wide range of
date formatting available.

alt.perl may be a better group for you to sort this through.

Jeff





My form is using a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top