On 11/01/2006 12:04 AM, 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);
Is this what you're looking to do?
use POSIX qw(mktime ctime);
my @ary = (0) x 9;
@ary[3,4,5] = (1,10,107);
{
local $\ = "\n";
my $tstamp = mktime(@ary);
print $tstamp;
print ctime($tstamp);
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>