[EMAIL PROTECTED] wrote:

> Ok, I figured it out!
> 
> I was reading the perl documentation on the "localtime" function, and it
> mentions that to get the last two digits in the year you would do:
> 
>      $year = sprintf("%02d", $year % 100);
> 
> So I figured, maybe this will work for the month and day. I created the
> following perl script:
> 
>      @d = localtime;
>      $mm = sprintf("%02d", ($d[4]+1) % 100);
>      $dd = sprintf("%02d", $d[3] % 100);
>      rename $ARGV[0], "$ARGV[0].".($d[5]+1900).$mm.$dd;
> 
> This did pretty much what I expected, but I have to admit I'm not sure
> exactly how. It appears that I am telling it to convert the variable into a
> percentage and then taking only the last two characters. I tested it by
> setting the date to something with a 2 digit month and day (Nov 27) and it
> still worked.

Actually "%02d" is a printf/sprintf formatting specification say 
"produce a decimal with at least two digits to the left of the decimal 
and use 0's for left padding." For more information on these format 
specs see your favorite C programming tutorial or reference.



Jeremy Wadsack
Wadsack-Allen Digital Group

------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------

Reply via email to