Hi Craig,
I'm not sure if this is what your trying to do but this has worked for me.
my ($mday, $mon, $year) = (localtime)[3..5];
#++$mon; #for those people that don't count months starting with 0
$year = sprintf("%02d", $year % 100);
my %calnames = ( 0 =>'Jan' , 1=>'Feb',
2=>'Mar', 3=>'April',
4=>'May', 5=>'Jun',
6=>'Jul', 7=>'Aug',
8 =>'Sep', 9=>'Oct',
10=>'Nov', 11=>'Dec',
);
my $date = ("$calnames{$mon} "."$mday\,"."$year");
my $out="$calnames{$mon}"."$mday"."$year";
my $workbook=Spreadsheet::WriteExcel->new("$out.xls")|| die "Can't open Spreadsheet: $!"; #Output file created here
my $worksheet=$workbook->addworksheet("Report for $date"); #New worksheet added to file here
Thank you,
Todd Pardi
IT Storage Management
Storage Administrator
"Craig Sharp"
<[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 07/23/2004 10:57 AM |
|
I need to get 2 digit time and date in a scalar when there is only 1 digit.
Eg: Using printf with %02d, I am able to get 05 to print at 5 min past the hour.
printf("%02d",$Minute)
I need to assign this output to a scalar variable so that I can use it as part of a filename later in the code. This is a snippit of what I tried.
$realminute = printf("%02d",$Minute);
This works but prints the formatted minute. I do not want it to print, just assign the scalar with two digits.
Craig A. Sharp
Unix Systems Administrator
DNS Administrator
Security Administrator
Roush Industries
Office: 734-466-6286
Cell: 734-231-6769
Fax: 734-466-6939
[EMAIL PROTECTED]
====================================================
I have not lost my mind, it's backed up on tape somewhere!
====================================================
CONFIDENTIALITY NOTE
This electronic transmission, including all attachments, is directed in confidence solely to the person(s) to which it is addressed, or an authorized recipient, and may not otherwise be distributed, copied or disclosed. The contents of the transmission may also be subject to intellectual property rights and all such rights are expressly claimed and are not waived. If you have received this transmission in error, please notify the sender immediately by return electronic transmission and then immediately delete this transmission, including all attachments, without copying, distributing or disclosing same.
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs