Sara wrote: > I am getting Month, Day and Year from Drop Downs of a form to convert given > values to Unix timestamp. I am able to put values in all the variables > below except for $wday & $yday. Any ideas as how I can get those with > limited user input of month, day and year only? > > #!/usr/local/bin/perl > use POSIX; > > $sec = 1; > $min = 0; > $hour = 0; > $mday = 01; > $mon = 10; > $year = 107; > $wday = ?; > $yday = ?; > $timestamp = mktime($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,-1); > print ($timestamp);
The only values that you have to supply to POSIX::mktime() are the first six, the other values are recomputed, so: my ( $sec, $min, $hour, $mday, $mon, $year ) = ( 1, 0, 0, 1, 10, 107 ); my $timestamp = mktime( $sec, $min, $hour, $mday, $mon, $year ); John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>