create a freeformat hidden variable and set the value using javascript.
<input name="freeformat_today" id="freeformat_today" type="hidden">
<script type="text/javascript">
var d=new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
document.getElementById("freeformat_today").value = weekday[d.getDay()];
</script>
or you can use unverified perl to achieve it. The advantage of perl is that the value is computed as the page loads not after. Also it will take the date from the server not the client. This is a catch 22. If the server has the correct date which is the case 99% of the time then there is no problem. The javascript will take the time from the client machine.
<input name="freeformat_today" id="freeformat_today" type="hidden" value="
[% Begin Unverified Perl
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
my @WeekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
return $WeekDays[$wday];
End Unverified %]
">
This is really good as the client can now decide whether he wants the day to be captured from the respondent's machine or from the server. And it gives me some valuable insight into storing variables using Javascript.
Happy days :-)
edited Nov 4, 2011 by Walter Williams